aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/agentx
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2005-05-10 23:45:39 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2005-05-10 23:45:39 +0000
commit36749ba62003a4e634cba9242e83e9caaae81978 (patch)
tree9ac47ccb5cf84e87bc625d62eb26455e163151a4 /plugins/agentx
parenta24ebb854bb036f53a9c73c1dd289878ba44d9b7 (diff)
Don't write a '\0' way the heck past the end of an array. Fixes bug 164.
Add a comment asking if we shouldn't use oid_to_str() instead of our own routine. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14344 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'plugins/agentx')
-rw-r--r--plugins/agentx/packet-agentx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/agentx/packet-agentx.c b/plugins/agentx/packet-agentx.c
index 54091e3127..863d2fa93f 100644
--- a/plugins/agentx/packet-agentx.c
+++ b/plugins/agentx/packet-agentx.c
@@ -303,6 +303,7 @@ static const value_string resp_errors[] = {
tvb_get_ntohs(tvb, offset) : \
tvb_get_letohs(tvb, offset)
+/* XXX - Is there a particular reason we're not using oid_to_str() here? */
static int dissect_octet_string(tvbuff_t *tvb, proto_tree *tree, int offset, char flags)
{
guint32 n_oct, p_noct;
@@ -311,6 +312,8 @@ static int dissect_octet_string(tvbuff_t *tvb, proto_tree *tree, int offset, cha
NORLEL(flags, n_oct, tvb, offset);
p_noct = PADDING(n_oct);
+ if (n_oct >= 1024)
+ THROW(ReportedBoundsError);
tvb_get_nstringz(tvb, offset + 4, n_oct, context);
context[n_oct]='\0';