summaryrefslogtreecommitdiff
path: root/wiretap/daintree-sna.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-12-14 14:42:54 -0800
committerGuy Harris <guy@alum.mit.edu>2016-12-14 22:43:46 +0000
commit5fdbb7a5ac8a0a68b42264bde094b90d455350e5 (patch)
tree9f5358822596ed6caa7f170d4c9fa9c6600b1def /wiretap/daintree-sna.c
parentf78b60dce827522195e0c5317a46aadeff76ef86 (diff)
downloadwireshark-5fdbb7a5ac8a0a68b42264bde094b90d455350e5.tar.gz
Don't assume we've read a line long enough to contain a magic number.
Check the length of the line first. Bug: 13246 Change-Id: I906bb652594898061afb4b2cd4edb916af354161 Reviewed-on: https://code.wireshark.org/review/19273 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/daintree-sna.c')
-rw-r--r--wiretap/daintree-sna.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c
index 233c08e274..dfb51c27a3 100644
--- a/wiretap/daintree-sna.c
+++ b/wiretap/daintree-sna.c
@@ -95,7 +95,8 @@ wtap_open_return_val daintree_sna_open(wtap *wth, int *err, gchar **err_info)
}
/* check magic text */
- if (memcmp(readLine, daintree_magic_text, DAINTREE_MAGIC_TEXT_SIZE) != 0)
+ if (strlen(readLine) >= DAINTREE_MAGIC_TEXT_SIZE &&
+ memcmp(readLine, daintree_magic_text, DAINTREE_MAGIC_TEXT_SIZE) != 0)
return WTAP_OPEN_NOT_MINE; /* not daintree format */
/* read second header line */