aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-09-07 10:43:15 -0700
committerGuy Harris <guy@alum.mit.edu>2016-09-07 20:41:53 +0000
commitc7fc2802221877d939bb939f04766a5a30cfdb9f (patch)
tree7762d3a9dbf0cd8caffdfed880ce576c3e5cb1cd /wiretap
parenta66aa4c9c90017f0c03412b02a2be2b2cef3ac5d (diff)
Make the ws_strto* routines more like the strto* routines.
Not all uses of atoi() or various strto* routines in Wireshark expect the string to contain *only* a number, so not all uses should require that the byte after the number be a '\0'. Have the ws_strto* routines take a "pointer a pointer set to point to the character after the number" argument, and have the callers do the appropriate checks of the character after that. This fixes the VMS trace reading code so that it can read those files again. The get_ routines are handed command-line arguments, so they *do* expect the string to contain only a number; have them check to make sure the byte after the number is a '\0'. Change-Id: I46fc1bea7912b9278e385fe38491a0a2ad60d697 Reviewed-on: https://code.wireshark.org/review/17560 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/vms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/wiretap/vms.c b/wiretap/vms.c
index 7f6a779089..9180c0e461 100644
--- a/wiretap/vms.c
+++ b/wiretap/vms.c
@@ -328,6 +328,7 @@ parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gch
struct tm tm;
char mon[4] = {'J', 'A', 'N', 0};
gchar *p;
+ const gchar *endp;
static const gchar months[] = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
guint32 i;
int offset = 0;
@@ -388,7 +389,7 @@ parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gch
return FALSE;
}
- if (!ws_strtou32(p, &pkt_len)) {
+ if (!ws_strtou32(p, &endp, &pkt_len) || (*endp != '\0' && !g_ascii_isspace(*endp))) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("vms: Length field '%s' not valid", p);
return FALSE;