From: Marc Hoersken Date: Sat, 19 Apr 2014 14:00:43 +0000 (+0200) Subject: netrc.c: fix multiple possible dereferences of null pointers X-Git-Tag: upstream/7.37.1~305 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=549b4a659a7ffabe499369869abf05762a4c0287;p=platform%2Fupstream%2Fcurl.git netrc.c: fix multiple possible dereferences of null pointers --- diff --git a/lib/netrc.c b/lib/netrc.c index a092314..a1b00b2 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -61,7 +61,7 @@ int Curl_parsenetrc(const char *host, { FILE *file; int retcode=1; - int specific_login = (**loginp != 0); + int specific_login = (*loginp && **loginp != 0); bool netrc_alloc = FALSE; enum host_lookup_state state=NOTHING; @@ -113,7 +113,7 @@ int Curl_parsenetrc(const char *host, tok=strtok_r(netrcbuffer, " \t\n", &tok_buf); while(!done && tok) { - if(**loginp && **passwordp) { + if((*loginp && **loginp) && (*passwordp && **passwordp)) { done=TRUE; break; }