Commit 379e689d authored by Andrew Tridgell's avatar Andrew Tridgell

fixed bug where strtok() could return NULL in getpassf().

parent 65575e96
...@@ -170,8 +170,10 @@ static char *getpassf(char *filename) ...@@ -170,8 +170,10 @@ static char *getpassf(char *filename)
buffer[sizeof(buffer)-1]='\0'; buffer[sizeof(buffer)-1]='\0';
if ( (len=read(fd,buffer,sizeof(buffer)-1)) > 0) if ( (len=read(fd,buffer,sizeof(buffer)-1)) > 0)
{ {
char *p = strtok(buffer,"\n\r");
close(fd); close(fd);
return strdup(strtok(buffer,"\n\r")); if (p) p = strdup(p);
return p;
} }
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment