plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit 32c6e78c6c4c13b63d8dc30aa395cfcc6e686c0a
parent c99867c9e05dd31fce28ae16aad083e893514f5a
Author: David du Colombier <0intro@gmail.com>
Date:   Thu,  5 Jun 2014 18:46:28 +0200

upas: fix nil pointer dereference

R=rsc
https://codereview.appspot.com/92650043

Diffstat:
Msrc/cmd/upas/smtp/smtp.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cmd/upas/smtp/smtp.c b/src/cmd/upas/smtp/smtp.c @@ -229,7 +229,7 @@ threadmain(int argc, char **argv) for(i = 0; i < argc; i++){ if((trv = rcptto(argv[i])) != 0){ /* remember worst error */ - if(strcmp(rv, Giveup) != 0) + if(rv != nil && strcmp(rv, Giveup) != 0) rv = trv; errs[rcvrs] = strdup(s_to_c(reply)); removenewline(errs[rcvrs]); @@ -241,7 +241,7 @@ threadmain(int argc, char **argv) } /* if no ok rcvrs or worst error is retry, give up */ - if(ok == 0 || strcmp(rv, Retry) == 0) + if(ok == 0 || (rv != nil && strcmp(rv, Retry) == 0)) goto error; if(ping){