rt: Allocate room for null terminator in logging spec

This commit is contained in:
Brian Anderson 2011-05-13 22:42:52 -04:00
parent 85120d9959
commit 9e9d57657d

View File

@ -239,8 +239,9 @@ void update_log_settings(void* crate_map, char* settings) {
log_directive dirs[256];
size_t n_dirs = 0;
if (settings) {
buffer = (char*)malloc(strlen(settings));
strcpy(buffer, settings);
size_t buflen = strlen(settings) + 1;
buffer = (char*)malloc(buflen);
strncpy(buffer, settings, buflen);
n_dirs = parse_logging_spec(buffer, &dirs[0]);
}