From 7b61889b4e599ebfe95ca91bb8712a9e659ab3fa Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Sat, 26 Jul 2025 02:28:21 +0200 Subject: output: max UID is signed 32bit -> more buffer --- src/output.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2