summaryrefslogtreecommitdiffstats
path: root/pw/pw_conf.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2001-08-20 13:24:39 +0000
committerBrian Somers <brian@FreeBSD.org>2001-08-20 13:24:39 +0000
commit4b3445eae2d7564a4289afb2255dd4c60777519b (patch)
tree44d585f648aef7ff51a34121051a7bfabe84de69 /pw/pw_conf.c
parent6d8540bb6ceb61f56a116c62fba48287e24bbb65 (diff)
downloadpw-darwin-4b3445eae2d7564a4289afb2255dd4c60777519b.tar.gz
pw-darwin-4b3445eae2d7564a4289afb2255dd4c60777519b.tar.zst
pw-darwin-4b3445eae2d7564a4289afb2255dd4c60777519b.zip
Handle snprintf() returning -1.
MFC after: 2 weeks
Diffstat (limited to 'pw/pw_conf.c')
-rw-r--r--pw/pw_conf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pw/pw_conf.c b/pw/pw_conf.c
index 0580091..e4c5a4a 100644
--- a/pw/pw_conf.c
+++ b/pw/pw_conf.c
@@ -420,6 +420,8 @@ write_userconfig(char const * file)
for (j = k = 0; j < _UC_MAXSHELLS && system_shells[j] != NULL; j++) {
char lbuf[64];
int l = snprintf(lbuf, sizeof lbuf, "%s\"%s\"", k ? "," : "", system_shells[j]);
+ if (l == -1)
+ l = 0;
if (l + k + 1 < len || extendline(&buf, &len, len + LNBUFSZ) != -1) {
strcpy(buf + k, lbuf);
k += l;
@@ -438,6 +440,8 @@ write_userconfig(char const * file)
for (j = k = 0; j < config.numgroups && config.groups[j] != NULL; j++) {
char lbuf[64];
int l = snprintf(lbuf, sizeof lbuf, "%s\"%s\"", k ? "," : "", config.groups[j]);
+ if (l == -1)
+ l = 0;
if (l + k + 1 < len || extendline(&buf, &len, len + 1024) != -1) {
strcpy(buf + k, lbuf);
k += l;