summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1995-09-05 19:52:59 +0000
committerBill Paul <wpaul@FreeBSD.org>1995-09-05 19:52:59 +0000
commit400b841301577780e22d5ec5c549022241590f94 (patch)
treeb9071750e8f558f5bf751447c7e23bc22298de0a /lib
parentc734076e9c356c0fb652384da2e33895e2b7af2c (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getgrent.c5
-rw-r--r--lib/libc/gen/getpwent.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 0d393bee96f9..d4e07949fbb4 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -409,7 +409,10 @@ unpack:
strcpy(resultbuf, result);
free(result);
if(result = strchr(resultbuf, '\n')) *result = '\0';
- return(_gr_breakout_yp(gr, resultbuf));
+ if (_gr_breakout_yp(gr, resultbuf))
+ return(1);
+ else
+ goto tryagain;
}
}
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 605ecac10779..71c0ae0e0541 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -670,7 +670,7 @@ _getyppass(struct passwd *pw, const char *name, const char *map)
if(resultlen >= sizeof resultbuf) return 0;
strcpy(resultbuf, result);
- sprintf (user, "%.*s", (strchr(result, ':') - result), result);
+ snprintf (user, sizeof(user), "%.*s", (strchr(result, ':') - result), result);
_pw_passwd.pw_fields = -1; /* Impossible value */
if (_scancaches((char *)&user)) {
free(result);
@@ -736,7 +736,7 @@ unpack:
}
strcpy(resultbuf, result);
- sprintf(user, "%.*s", (strchr(result, ':') - result), result);
+ snprintf(user, sizeof(user), "%.*s", (strchr(result, ':') - result), result);
_pw_passwd.pw_fields = -1; /* Impossible value */
if (_scancaches((char *)&user)) {
free(result);
@@ -747,7 +747,10 @@ unpack:
if (_pw_passwd.pw_fields == -1)
goto tryagain;
if(result = strchr(resultbuf, '\n')) *result = '\0';
- return(_pw_breakout_yp(pw, resultbuf, gotmaster));
+ if (_pw_breakout_yp(pw, resultbuf, gotmaster))
+ return(1);
+ else
+ goto tryagain;
}
}