aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2006-01-17 18:50:02 +0000
committerGerald Combs <gerald@wireshark.org>2006-01-17 18:50:02 +0000
commit4b15bf76a7f7b37b995f218de312cf703168f98f (patch)
tree377a3b7ecd2f22cabce694b8c0664a7ee84f85c7 /epan/to_str.c
parent467de087cc6aca4e2df2a910570605f8fc2b2b4e (diff)
Fix an off-by-one error. Fixes bug 698, possibly others.
svn path=/trunk/; revision=17048
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/epan/to_str.c b/epan/to_str.c
index 8363fe748e..f4181a187f 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -837,6 +837,7 @@ gchar* oid_to_str(const guint8 *oid, gint oid_len) {
return oid_to_str_buf(oid, oid_len, buf, MAX_OID_STR_LEN);
}
+#define OID_STR_LIMIT (1 + 10 + 4 + 1) /* "." + 10 digits + ".>>>" + '\0' */
gchar* oid_to_str_buf(const guint8 *oid, gint oid_len, gchar *buf, int buf_len) {
gint i;
guint8 byte;
@@ -847,7 +848,7 @@ gchar* oid_to_str_buf(const guint8 *oid, gint oid_len, gchar *buf, int buf_len)
bufp = buf; subid = 0; is_first = TRUE;
for (i=0; i<oid_len; i++){
byte = oid[i];
- if ((bufp - buf) > (buf_len - 15)) {
+ if ((bufp - buf) > (buf_len - OID_STR_LIMIT)) {
bufp += g_snprintf(bufp, buf_len-(bufp-buf), ".>>>");
break;
}