aboutsummaryrefslogtreecommitdiffstats
path: root/epan/oids.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-10-15 12:34:45 +0000
committerEvan Huus <eapache@gmail.com>2013-10-15 12:34:45 +0000
commita6d8e1888c74c9e88957c1e663caec2bab16551e (patch)
treeef6b5663744c9440424dbd2dbe60bd287549e562 /epan/oids.c
parent8956ee2a567e2e2e4d8b8704d80beb9cde6678b1 (diff)
Fix a length check in the OID code, we add an extra byte if is_first, not the
other way around. Also add an assert so it blows up if we get it wrong, rather than leading to uninitialized memory. Fixes the last errors I can find in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9268 svn path=/trunk/; revision=52615
Diffstat (limited to 'epan/oids.c')
-rw-r--r--epan/oids.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/epan/oids.c b/epan/oids.c
index f232d93c20..2fc41deabe 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -950,7 +950,7 @@ guint oid_encoded2subid_sub(const guint8 *oid_bytes, gint oid_len, guint32** sub
* 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 ((is_first && n == 0) || (!is_first && n == 1)) {
+ if ((is_first && n == 1) || (!is_first && n == 0)) {
*subids = 0;
return n;
}
@@ -985,6 +985,8 @@ guint oid_encoded2subid_sub(const guint8 *oid_bytes, gint oid_len, guint32** sub
subid = 0;
}
+ g_assert(subids == subid_overflow);
+
return n;
}