diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/debug.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 1a926053bb..fe4cd52a8b 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -208,8 +208,8 @@ static char *debug_list_class_names_and_levels(void) dim += l; } - /* create single string list */ - b = buf = malloc(dim); + /* create single string list - add space for newline */ + b = buf = malloc(dim+1); if (!buf) { err = True; goto done; @@ -219,7 +219,8 @@ static char *debug_list_class_names_and_levels(void) strncpy(b, list[i], l); b = b + l; } - b[-1] = '\0'; + b[-1] = '\n'; /* replace last space with newline */ + b[0] = '\0'; /* null terminate string */ done: /* free strings list */ |