summaryrefslogtreecommitdiff
path: root/lib/tftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-01-28 20:39:25 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-01-28 22:17:16 +0100
commitbcb19883a8e422f3e32a740a3cd68c2d34bff100 (patch)
tree175d5cc21f1d5778da782b82944b280c443ba43d /lib/tftp.c
parentf2e42dd056b3b3afcf0389f6f390551a06bea26b (diff)
downloadgnurl-bcb19883a8e422f3e32a740a3cd68c2d34bff100.tar.gz
gnurl-bcb19883a8e422f3e32a740a3cd68c2d34bff100.tar.bz2
gnurl-bcb19883a8e422f3e32a740a3cd68c2d34bff100.zip
TFTP: fix crash on time-out
tftp_done() can get called with its TFTP state pointer still being NULL on an early time-out, which caused a segfault when dereferenced. Reported-by: Glenn Sheridan Bug: http://curl.haxx.se/mail/lib-2014-01/0246.html
Diffstat (limited to 'lib/tftp.c')
-rw-r--r--lib/tftp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index 5b473d706..269d10f7a 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1041,7 +1041,8 @@ static CURLcode tftp_done(struct connectdata *conn, CURLcode status,
return CURLE_ABORTED_BY_CALLBACK;
/* If we have encountered an error */
- code = tftp_translate_code(state->error);
+ if(state)
+ code = tftp_translate_code(state->error);
return code;
}