PR: 198554
Reported by: diaran <fbsd@centraltech.co.uk>
MFC after: 2 days
#include <string.h>
#include <stdlib.h>
#include <sys/param.h>
#include <string.h>
#include <stdlib.h>
#include <sys/param.h>
if (line[linelen - 1 ] == '\n')
line[linelen - 1] = '\0';
pw = pw_scan(line, PWSCAN_MASTER);
if (line[linelen - 1 ] == '\n')
line[linelen - 1] = '\0';
pw = pw_scan(line, PWSCAN_MASTER);
+ if (pw == NULL)
+ errx(EXIT_FAILURE, "Invalid user entry in '%s':"
+ " '%s'", getpwpath(_MASTERPASSWD), line);
if (uid != (uid_t)-1) {
if (uid == pw->pw_uid)
break;
if (uid != (uid_t)-1) {
if (uid == pw->pw_uid)
break;
if (line[linelen - 1 ] == '\n')
line[linelen - 1] = '\0';
gr = gr_scan(line);
if (line[linelen - 1 ] == '\n')
line[linelen - 1] = '\0';
gr = gr_scan(line);
+ if (gr == NULL)
+ errx(EXIT_FAILURE, "Invalid group entry in '%s':"
+ " '%s'", getgrpath(_GROUP), line);
if (gid != (gid_t)-1) {
if (gid == gr->gr_gid)
break;
if (gid != (gid_t)-1) {
if (gid == gr->gr_gid)
break;