diff options
| -rw-r--r-- | src/output.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/output.c b/src/output.c index 1c3678d..daf16d3 100644 --- a/src/output.c +++ b/src/output.c @@ -337,8 +337,8 @@ inline size_t estimate_formatted_line_length(const char *format, size_t longest_ case 'G': case 'U': rc += ((unsigned int)login_name_max); break; case 'g': /* Short ones */ - case 'p': - case 'u': rc += 8; break; + case 'u': rc += 14; break; + case 'p': rc += 8; break; case ' ': break; default: rc += 28; /* time, and strings >10 in format*/ }; @@ -358,7 +358,7 @@ inline void out_print_format_string_header(const char *format, size_t longest_fn format_len = strnlen(format, DM_OUT_FORMAT_MAX_LEN); est_length = estimate_formatted_line_length(format, longest_fname); - if ((header=calloc(est_length, sizeof(char))) == NULL) { + if ((header=calloc(est_length+1, sizeof(char))) == NULL) { LOGERR("ERROR: Failed to allocate memory for header\n"); return; } @@ -366,7 +366,7 @@ inline void out_print_format_string_header(const char *format, size_t longest_fn pos = header; if (option_print_boxed_table) { - if ((sep_line=calloc(est_length, sizeof(char))) == NULL) { + if ((sep_line=calloc(est_length+1, sizeof(char))) == NULL) { free(header); LOGERR("ERROR: Failed to allocate memory for sep line\n"); return; |
