Created attachment 2953 [details] Proposed patch insmod/modprobe incorrectly parses several char & string parameters in kernel 2.4 Sample output: # insmod netconsole.o netconsole=@/,@192.168.1.100/ insmod: parameter netconsole requires at least 2 arguments # modinfo netconsole.o filename: netconsole.o parm_desc_netconsole: netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr] parm_netconsole:2s license: GPL description: Network console driver author: Maintainer: Herbert P�tzl <herbert@13thfloor.at> kernel_version: 2.4.37.11 This happens due to "Parse parameter values" loop in modutils-24.c: new_process_module_arguments() wants to recheck ',' delimiter at the end of switch (*pinfo), but it already overwritten by '\0' symbol in code above for 's' & 'c' cases. Patch attached solves problem for me.
- p = skip_whitespace(p); - if (*p != ',') - break; + if (*p != '\0') { + p = skip_whitespace(p); + if (*p != ',') + break; + } p = skip_whitespace(p + 1); And if *p == '\0' because we genuinely reached terminating NUL, not because we replaces ',' with '\0', then what p = skip_whitespace(p + 1) do?
I propose to save/restore the character, like this: char sv_ch = p[len]; p[len] = '\0'; obj_string_patch(f, sym->secidx, loc - contents, p); loc += tgt_sizeof_char_p; p += len; *p = sv_ch;
You are right, my patch breaks some checks. Anyway, bug fixed & can be closed.
Fixed in 1.19.x