* Replacing strdup() with strndup() throughout
[monky] / src / top.c
index 5bf7b03..7311634 100644 (file)
--- a/src/top.c
+++ b/src/top.c
@@ -183,7 +183,7 @@ static int process_parse_stat(struct process *process)
        if (process->name) {
                free(process->name);
        }
-       process->name = strdup(deparenthesised_name);
+       process->name = strndup(deparenthesised_name, text_buffer_size);
        process->rss *= getpagesize();
 
        if (!cur->memmax) {