From 10944395bfc989fc21fb385eb652cc274aa78a0a Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 13 Oct 2006 23:35:53 +0000 Subject: [PATCH] Changed sprintf() calls to snprintf() calls. --- uidlist.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/uidlist.c b/uidlist.c index 13f54d6c..83eee454 100644 --- a/uidlist.c +++ b/uidlist.c @@ -126,12 +126,10 @@ static int is_in_group(gid_t gid) char *gidbuf = new_array(char, ngroups*21+32); if (!gidbuf) out_of_memory("is_in_group"); - sprintf(gidbuf, "process has %d gid%s: ", - ngroups, ngroups == 1? "" : "s"); - pos = strlen(gidbuf); + pos = snprintf(gidbuf, 32, "process has %d gid%s: ", + ngroups, ngroups == 1? "" : "s"); for (n = 0; n < ngroups; n++) { - sprintf(gidbuf+pos, " %d", (int)gidset[n]); - pos += strlen(gidbuf+pos); + pos += snprintf(gidbuf+pos, 21, " %d", (int)gidset[n]); } rprintf(FINFO, "%s\n", gidbuf); free(gidbuf); -- 2.34.1