From 4b15bf76a7f7b37b995f218de312cf703168f98f Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 17 Jan 2006 18:50:02 +0000 Subject: Fix an off-by-one error. Fixes bug 698, possibly others. svn path=/trunk/; revision=17048 --- epan/to_str.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'epan/to_str.c') 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 (buf_len - 15)) { + if ((bufp - buf) > (buf_len - OID_STR_LIMIT)) { bufp += g_snprintf(bufp, buf_len-(bufp-buf), ".>>>"); break; } -- cgit v1.2.3