From: Ben Pfaff Date: Sun, 4 Jun 2023 14:40:47 +0000 (-0700) Subject: dictionary: Properly size string buffer in make_hinted_name(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=733154a78524daecf1542c4f6fba96474ac3426f;p=pspp dictionary: Properly size string buffer in make_hinted_name(). This causes a test failure on 32-bit platforms, where INT_BUFSIZE_BOUND(unsigned long) is smaller than F26ADIC_STRLEN_MAX + 1. Fixes: 2ba8dc2955f8 ("spreadsheet-reader: Merge duplicate code with libpspp/str.h.") Thanks to Friedrich Beckmann for reporting the problem. --- diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 653ed941f1..8b5f381296 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -1167,7 +1167,7 @@ make_hinted_name (const struct dictionary *dict, const char *hint) for (i = 0; i < ULONG_MAX; i++) { - char suffix[INT_BUFSIZE_BOUND (i) + 1]; + char suffix[1 + F26ADIC_STRLEN_MAX + 1]; suffix[0] = '_'; str_format_26adic (i + 1, true, &suffix[1], sizeof suffix - 1);