From: Guy Harris Date: Wed, 7 Sep 2016 04:47:27 +0000 (-0700) Subject: Further ws_strto* cleanups. X-Git-Url: http://git.samba.org/?p=metze%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=7786a975af5492160e48a2d0168365b57e0a0770 Further ws_strto* cleanups. Make pkt_len unsigned. Improve the error message for ws_strtou32() failure. Change-Id: I080b4fc132c8e405bc1dbd87fc717c2b337517bc Reviewed-on: https://code.wireshark.org/review/17547 Reviewed-by: Guy Harris --- diff --git a/wiretap/vms.c b/wiretap/vms.c index 47eed25e4b..7f6a779089 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -320,17 +320,17 @@ isdumpline( gchar *line ) static gboolean parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { - char line[VMS_LINE_LENGTH + 1]; - int num_items_scanned; - int pkt_len = 0; - int pktnum; - int csec = 101; + char line[VMS_LINE_LENGTH + 1]; + int num_items_scanned; + guint32 pkt_len = 0; + int pktnum; + int csec = 101; struct tm tm; char mon[4] = {'J', 'A', 'N', 0}; - gchar *p; + gchar *p; static const gchar months[] = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"; - int i; - int offset = 0; + guint32 i; + int offset = 0; guint8 *pd; tm.tm_year = 1970; @@ -388,9 +388,9 @@ parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gch return FALSE; } - if (!ws_strtoi32(p, &pkt_len)) { + if (!ws_strtou32(p, &pkt_len)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("vms: packet length: %s", p); + *err_info = g_strdup_printf("vms: Length field '%s' not valid", p); return FALSE; } break;