diff options
author | Andrew Tridgell <tridge@samba.org> | 1999-01-08 10:42:29 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1999-01-08 10:42:29 +0000 |
commit | 379e689dacec3b520d0e6fd6d655034f924a811b (patch) | |
tree | abe1ffe2f6086eb31590799596cd844a0962623d /authenticate.c | |
parent | 65575e9670fb77ececc8255d572d08d7b10bb049 (diff) | |
download | rsync-379e689dacec3b520d0e6fd6d655034f924a811b.tar.gz |
fixed bug where strtok() could return NULL in getpassf().
Diffstat (limited to 'authenticate.c')
-rw-r--r-- | authenticate.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/authenticate.c b/authenticate.c index 896366aa..885e40b6 100644 --- a/authenticate.c +++ b/authenticate.c @@ -170,8 +170,10 @@ static char *getpassf(char *filename) buffer[sizeof(buffer)-1]='\0'; if ( (len=read(fd,buffer,sizeof(buffer)-1)) > 0) { + char *p = strtok(buffer,"\n\r"); close(fd); - return strdup(strtok(buffer,"\n\r")); + if (p) p = strdup(p); + return p; } return NULL; |