aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-04-18 18:05:08 -0700
committerGuy Harris <guy@alum.mit.edu>2016-04-19 01:06:18 +0000
commitc943afbdacb2bfaa94500d2eb1705541bf3ebffb (patch)
tree8d28ea293fac613db293b54a7338f08ef8aaddd5 /wiretap
parent6206f347dfca8686acd251917174ed361ef75671 (diff)
Use memcmp() to check the magic number.
We just care whether the first 6 bytes of the file are "MPCSII"; memcmp() will do that, and we don't have to worry about NULs. Change-Id: I03872c30e76eedce67577657270e36f0795e74bd Reviewed-on: https://code.wireshark.org/review/14994 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/mplog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/wiretap/mplog.c b/wiretap/mplog.c
index ed6024d575..87e5e7a587 100644
--- a/wiretap/mplog.c
+++ b/wiretap/mplog.c
@@ -211,7 +211,7 @@ mplog_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *pkthdr,
wtap_open_return_val mplog_open(wtap *wth, int *err, gchar **err_info _U_)
{
gboolean ok;
- guint8 str[10];
+ guint8 str[6];
/* rewind the fh so we re-read from the beginning */
if (-1 == file_seek(wth->fh, 0, SEEK_SET, err))
@@ -220,7 +220,7 @@ wtap_open_return_val mplog_open(wtap *wth, int *err, gchar **err_info _U_)
ok = wtap_read_bytes_or_eof(wth->fh, str, 6, err, err_info);
if (!ok)
return WTAP_OPEN_NOT_MINE;
- if (strncmp(str, "MPCSII", 6))
+ if (memcmp(str, "MPCSII", 6) != 0)
return WTAP_OPEN_NOT_MINE;
wth->file_encap = WTAP_ENCAP_ISO14443;