modprobe: protect against possible SEGV
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
1aaf1cb096
commit
da879ec2e9
@ -80,6 +80,7 @@ static int read_config(const char *path);
|
|||||||
static char *gather_options_str(char *opts, const char *append)
|
static char *gather_options_str(char *opts, const char *append)
|
||||||
{
|
{
|
||||||
/* Speed-optimized. We call gather_options_str many times. */
|
/* Speed-optimized. We call gather_options_str many times. */
|
||||||
|
if (append) {
|
||||||
if (opts == NULL) {
|
if (opts == NULL) {
|
||||||
opts = xstrdup(append);
|
opts = xstrdup(append);
|
||||||
} else {
|
} else {
|
||||||
@ -87,6 +88,7 @@ static char *gather_options_str(char *opts, const char *append)
|
|||||||
opts = xrealloc(opts, optlen + strlen(append) + 2);
|
opts = xrealloc(opts, optlen + strlen(append) + 2);
|
||||||
sprintf(opts + optlen, " %s", append);
|
sprintf(opts + optlen, " %s", append);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user