Executing para_play with an empty argument to --key-map results in
a read which starts one byte past the allocated buffer:
==24163== Invalid read of size 1
==24163== at 0x402A1DA: index (mc_replace_strmem.c:223)
==24163== by 0x804DA22: main (play.c:187)
==24163== Address 0x498e331 is 0 bytes after a block of size 1 alloc'd
This patch fixes the issue by rejecting empty arguments as invalid.
loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
for (i = 0; i < conf.key_map_given; i++) {
- char *s = strchr(conf.key_map_arg[i] + 1, ':');
- if (s)
+ char *kma = conf.key_map_arg[i];
+ if (*kma && strchr(kma + 1, ':'))
continue;
- PARA_EMERG_LOG("invalid key map arg: %s\n", conf.key_map_arg[i]);
+ PARA_EMERG_LOG("invalid key map arg: %s\n", kma);
goto err;
}
free(config_file);