Be sure to properly fail if there are not enough fields. Problem
reported by MARC Giannoni <marc@cmc.eng.comsat.com>, this fix is by me.
This commit is contained in:
parent
5d20b0e1a2
commit
cc6f628176
@ -110,10 +110,12 @@ pw_scan(bp, pw)
|
||||
if(p[0]) pw->pw_fields |= _PWF_EXPIRE;
|
||||
pw->pw_expire = atol(p);
|
||||
|
||||
pw->pw_gecos = strsep(&bp, ":"); /* gecos */
|
||||
if (!(pw->pw_gecos = strsep(&bp, ":"))) /* gecos */
|
||||
goto fmt;
|
||||
if(pw->pw_gecos[0]) pw->pw_fields |= _PWF_GECOS;
|
||||
|
||||
pw->pw_dir = strsep(&bp, ":"); /* directory */
|
||||
if (!(pw->pw_dir = strsep(&bp, ":"))) /* directory */
|
||||
goto fmt;
|
||||
if(pw->pw_dir[0]) pw->pw_fields |= _PWF_DIR;
|
||||
|
||||
if (!(pw->pw_shell = strsep(&bp, ":"))) /* shell */
|
||||
|
@ -110,10 +110,12 @@ pw_scan(bp, pw)
|
||||
if(p[0]) pw->pw_fields |= _PWF_EXPIRE;
|
||||
pw->pw_expire = atol(p);
|
||||
|
||||
pw->pw_gecos = strsep(&bp, ":"); /* gecos */
|
||||
if (!(pw->pw_gecos = strsep(&bp, ":"))) /* gecos */
|
||||
goto fmt;
|
||||
if(pw->pw_gecos[0]) pw->pw_fields |= _PWF_GECOS;
|
||||
|
||||
pw->pw_dir = strsep(&bp, ":"); /* directory */
|
||||
if (!(pw->pw_dir = strsep(&bp, ":"))) /* directory */
|
||||
goto fmt;
|
||||
if(pw->pw_dir[0]) pw->pw_fields |= _PWF_DIR;
|
||||
|
||||
if (!(pw->pw_shell = strsep(&bp, ":"))) /* shell */
|
||||
|
Loading…
Reference in New Issue
Block a user