]> The Tcpdump Group git mirrors - tcpdump/commitdiff
smbutil.c: Fix the strftime buffer size
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 28 Jan 2023 10:42:56 +0000 (11:42 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 28 Jan 2023 10:48:42 +0000 (11:48 +0100)
tm_year is an int, thus 'yyyy' for '%Y' is not enough.

This avoids a stack buffer overflow in some cases.

smbutil.c

index 7f609f7f3c242aa4a56d3bb9de3e181983154769..6e509ecf58fb804c8a3c3131d0ac86861248e43a 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -770,7 +770,7 @@ smb_fdata1(netdissect_options *ndo,
            time_t t;
            struct tm *lt;
            const char *tstring;
-           char buffer[sizeof("Www Mmm dd hh:mm:ss yyyy\n")];
+           char buffer[sizeof("Www Mmm dd hh:mm:ss yyyyy\n")];
            uint32_t x;
 
            switch (atoi(fmt + 1)) {