From 10635c896affd8d1a754122439460d8499527c4a Mon Sep 17 00:00:00 2001 From: mquinson Date: Mon, 17 Aug 2009 15:49:21 +0000 Subject: [PATCH] Use the right guard for snprintf (thanks to ubuntu stack for detecting the potential buffer overflow) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6586 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/xbt/xbt_log_layout_simple.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/xbt/xbt_log_layout_simple.c b/src/xbt/xbt_log_layout_simple.c index 77f6f090ed..c42e398682 100644 --- a/src/xbt/xbt_log_layout_simple.c +++ b/src/xbt/xbt_log_layout_simple.c @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: xbt_log_layout_simple.c 6309 2009-05-26 15:29:22Z mquinson $ */ /* layout_simple - a dumb log layout */ @@ -31,20 +31,20 @@ static void xbt_log_layout_simple_dynamic(xbt_log_layout_t l, /* Put every static information in a static buffer, and copy them in the dyn one */ p = loc_buff; - p += snprintf(p, 256 - (p - ev->buffer), "["); + p += snprintf(p, 256 - (p - loc_buff), "["); if (strlen(xbt_procname())) - p += snprintf(p, 256 - (p - ev->buffer), "%s:%s:(%d) ", + p += snprintf(p, 256 - (p - loc_buff), "%s:%s:(%d) ", gras_os_myname(), xbt_procname(), (*xbt_getpid) ()); p += - snprintf(p, 256 - (p - ev->buffer), "%f] ", + snprintf(p, 256 - (p - loc_buff), "%f] ", gras_os_time() - begin_of_time); if (ev->priority != xbt_log_priority_info) p += - snprintf(p, 256 - (p - ev->buffer), "%s:%d: ", ev->fileName, + snprintf(p, 256 - (p - loc_buff), "%s:%d: ", ev->fileName, ev->lineNum); p += - snprintf(p, 256 - (p - ev->buffer), "[%s/%s] ", ev->cat->name, + snprintf(p, 256 - (p - loc_buff), "[%s/%s] ", ev->cat->name, xbt_log_priority_names[ev->priority]); xbt_strbuff_append(buff, loc_buff); -- 2.20.1