X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/5caf4211264afa7d98820c6cbb6a03c27a388fec..9ca86a09271ae74dcc3fb376e4518b03e12f52f5:/smbutil.c diff --git a/smbutil.c b/smbutil.c index 6e509ecf..97217a8d 100644 --- a/smbutil.c +++ b/smbutil.c @@ -388,7 +388,7 @@ unistr(netdissect_options *ndo, char (*buf)[MAX_UNISTR_SIZE+1], } } if (!use_unicode) { - while (strsize != 0) { + while (strsize != 0) { c = GET_U_1(s); s++; strsize--; @@ -768,9 +768,8 @@ smb_fdata1(netdissect_options *ndo, case 'T': { time_t t; - struct tm *lt; const char *tstring; - char buffer[sizeof("Www Mmm dd hh:mm:ss yyyyy\n")]; + char buffer[sizeof("Www Mmm dd hh:mm:ss yyyyy")]; uint32_t x; switch (atoi(fmt + 1)) { @@ -800,16 +799,11 @@ smb_fdata1(netdissect_options *ndo, break; } if (t != 0) { - lt = localtime(&t); - if (lt != NULL) { - strftime(buffer, sizeof(buffer), "%a %b %e %T %Y%n", lt); - tstring = buffer; - } - else - tstring = "(Can't convert time)\n"; + tstring = nd_format_time(buffer, sizeof(buffer), "%a %b %e %T %Y", + localtime(&t)); } else - tstring = "NULL\n"; - ND_PRINT("%s", tstring); + tstring = "NULL"; + ND_PRINT("%s\n", tstring); fmt++; while (ND_ASCII_ISDIGIT(*fmt)) fmt++;