From bf4fd3eaef0d8334db1412ea6e25f4dd3c900a59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Thu, 28 Jan 2010 16:26:35 +0000 Subject: [PATCH] fix mac address are truncated problem when compiling ulogd with -D_FORTIFY_SOURCE=2, https://bugzilla.redhat.com/show_bug.cgi?id=247345 --- extensions/ulogd_BASE.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extensions/ulogd_BASE.c b/extensions/ulogd_BASE.c index 646f55f..42e23f4 100644 --- a/extensions/ulogd_BASE.c +++ b/extensions/ulogd_BASE.c @@ -65,7 +65,7 @@ static ulog_iret_t *_interp_raw(ulog_interpreter_t *ip, { unsigned char *p; int i; - char *buf, *oldbuf = NULL; + char *buf = NULL; ulog_iret_t *ret = ip->result; if (pkt->mac_len) { @@ -77,9 +77,8 @@ static ulog_iret_t *_interp_raw(ulog_interpreter_t *ip, *buf = '\0'; p = pkt->mac; - oldbuf = buf; for (i = 0; i < pkt->mac_len; i++, p++) - sprintf(buf, "%s%02x%c", oldbuf, *p, i==pkt->mac_len-1 ? ' ':':'); + sprintf(buf + (i*3), "%02x%c", *p, i==pkt->mac_len-1 ? ' ':':'); ret[0].value.ptr = buf; ret[0].flags |= ULOGD_RETF_VALID; } -- 2.45.2