diff --git a/epicardium/modules/config.c b/epicardium/modules/config.c index b1428dc3a8bda9a796a939d1a97a3ce48561123e..5be76cd97a3c3758efd5d5108165a2aa738f0b7a 100644 --- a/epicardium/modules/config.c +++ b/epicardium/modules/config.c @@ -73,15 +73,7 @@ static bool set_int(struct config_option *opt, const char *value) { char *endptr; size_t len = strlen(value); - int base = 10; - if (len > 2 && value[0] == '0' && value[1] == 'x') { - base = 16; -#ifdef CONFIG_ENABLE_OCTAL_NUMBERS - } else if (len > 1 && value[0] == '0') { - base = 8; -#endif - } - int v = strtol(value, &endptr, base); + int v = strtol(value, &endptr, 0); if (endptr != (value + len)) { return false; } @@ -122,8 +114,9 @@ static bool set_string(struct config_option *opt, const char *value) { //this leaks, but the lifetime of these ends when epicardium exits, so... size_t len = strlen(value); - char *leaks = (char *)malloc(len); + char *leaks = (char *)malloc(len + 1); strncpy(leaks, value, len); + leaks[len] = '\0'; opt->value.string = leaks; LOG_DEBUG("card10.cfg", "setting '%s' to %s", opt->name, elide(leaks)); return true;