From: Paul Mackerras Date: Sat, 10 Jul 2021 00:29:55 +0000 (+1000) Subject: plugins/radius: Use snprintf in rc_mksid X-Git-Tag: ppp-2.5.0~69 X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=301230f8fde94b5b80e9dfba51816ede340e6b64;p=ppp.git plugins/radius: Use snprintf in rc_mksid Commit 858976b1fc31 ("radius: Prevent buffer overflow in rc_mksid()") changed sprintf to slprintf to avoid a possible buffer overflow. However, this introduced a bug because slprintf does not currently handle the %lX and %hX formats. Use snprintf instead, which does, as we are not using any of the custom formats that slprintf handles in this instance. Reported-by: Adrian Ban Signed-off-by: Paul Mackerras --- diff --git a/pppd/plugins/radius/util.c b/pppd/plugins/radius/util.c index 740131e..751f819 100644 --- a/pppd/plugins/radius/util.c +++ b/pppd/plugins/radius/util.c @@ -75,7 +75,7 @@ rc_mksid (void) { static char buf[32]; static unsigned short int cnt = 0; - slprintf(buf, sizeof(buf), "%08lX%04X%02hX", + snprintf(buf, sizeof(buf), "%08lX%04X%02hX", (unsigned long int) time (NULL), (unsigned int) getpid (), cnt & 0xFF);