From c1d2109aeff13960693be57a3b16026b7d5a9708 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 19 Jun 2011 13:52:13 +0100 Subject: [PATCH] cleanup: buffer size for snprintf should come from sizeof Previously, hardcoded copies of the buffer size literals were used. Signed-off-by: Richard Kettlewell Signed-off-by: Ian Jackson --- site.c | 2 +- tun.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/site.c b/site.c index 567b85f..17c3af2 100644 --- a/site.c +++ b/site.c @@ -217,7 +217,7 @@ static void slog(struct site *st, uint32_t event, cstring_t msg, ...) default: class=M_ERR; break; } - vsnprintf(buf,240,msg,ap); + vsnprintf(buf,sizeof(buf),msg,ap); st->log->log(st->log->st,class,"%s: %s",st->tunname,buf); } va_end(ap); diff --git a/tun.c b/tun.c index d899f0c..5f9aa98 100644 --- a/tun.c +++ b/tun.c @@ -332,7 +332,7 @@ static void tun_phase_hook(void *sst, uint32_t newphase) hostaddr=ipaddr_to_string(st->local_address); secnetaddr=ipaddr_to_string(st->nl.secnet_address); - snprintf(mtu,6,"%d",st->nl.mtu); + snprintf(mtu,sizeof(mtu),"%d",st->nl.mtu); mtu[5]=0; switch (st->ifconfig_type) { -- 2.30.2