From b9233fc77ebda0f4d703b922ce01cb85c00eae07 Mon Sep 17 00:00:00 2001 From: gerald Date: Fri, 17 Jul 2009 15:59:24 +0000 Subject: Fix an ep buffer overrun introduced in r29130. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29133 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/to_str.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'epan/to_str.c') diff --git a/epan/to_str.c b/epan/to_str.c index 99d92b6a31..5b9e6ee489 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -589,9 +589,15 @@ display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 frac, a "-" in front of the entire time stamp. */ if (frac < 0) { frac = -frac; - if (sec >= 0) - buf[0] = '-'; - ++buf; } + if (sec >= 0) { + if (buflen < 1) { + return; + } + buf[0] = '\0'; + buf++; + buflen--; + } + } switch (units) { case SECS: @@ -637,9 +643,14 @@ display_epoch_time(gchar *buf, int buflen, time_t sec, gint32 frac, a "-" in front of the entire time stamp. */ if (frac < 0) { frac = -frac; - if (elapsed_secs >= 0) - buf[0] = '-'; - ++buf; + if (elapsed_secs >= 0) { + if (buflen < 1) { + return; + } + buf[0] = '\0'; + buf++; + buflen--; + } } switch (units) { -- cgit v1.2.3