diff options
author | Evan Huus <eapache@gmail.com> | 2012-08-12 21:04:39 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2012-08-12 21:04:39 +0000 |
commit | ad759c88f86b809033dc1c3187a7bf409f9f2b99 (patch) | |
tree | b4169dffcbd108977b7b69ebc479bc3dcecfb81f /epan/oids.c | |
parent | 38b39b6b77262cd0276fe31905ab2d4c4b1f7a88 (diff) |
Safely handle empty OIDs and other weird cases where we can't find a sub-id.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7219
svn path=/trunk/; revision=44460
Diffstat (limited to 'epan/oids.c')
-rw-r--r-- | epan/oids.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/epan/oids.c b/epan/oids.c index e2452560ab..e15717f467 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -938,6 +938,15 @@ guint oid_encoded2subid(const guint8 *oid_bytes, gint oid_len, guint32** subids_ *subids_p = subids = ep_alloc(sizeof(guint32)*n); subid_overflow = subids+n; + /* If n is 1 then we found no bytes in the OID with first bit cleared, + * so initialize our one byte to zero and return. This *seems* to be + * the right thing to do in this situation, and at the very least it + * avoids uninitialized memory errors that would otherwise occur. */ + if (n == 1) { + *subids = 0; + return n; + } + for (i=0; i<oid_len; i++){ guint8 byte = oid_bytes[i]; |