modprobe: fix a segfault when modprobe is called with no arguments at all

function                                             old     new   delta
modprobe_main                                        559     535     -24
This commit is contained in:
Denis Vlasenko 2008-10-31 02:04:28 +00:00
parent b9b344aa44
commit bb26db49b1
2 changed files with 29 additions and 25 deletions

View file

@ -106,7 +106,7 @@ char * FAST_FUNC parse_cmdline_module_options(char **argv)
while (*++argv) {
options = xrealloc(options, optlen + 2 + strlen(*argv) + 2);
/* Spaces handled by "" pairs, but no way of escaping quotes */
optlen += sprintf(options + optlen, (strchr(*argv,' ') ? "\"%s\" " : "%s "), *argv);
optlen += sprintf(options + optlen, (strchr(*argv, ' ') ? "\"%s\" " : "%s "), *argv);
}
return options;
}