summaryrefslogtreecommitdiffstats
path: root/Source/CTest/Curl
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-10-05 21:02:44 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-10-05 21:02:44 (GMT)
commitf47690ecaa6a99e4650f75a61201b2138c5680f4 (patch)
treebb1a70b0b4f60ad1737a950c74ceb2e807fc8d72 /Source/CTest/Curl
parentdecb1ac05fa550a8fc7378b59e6c83c4eed9720a (diff)
downloadCMake-f47690ecaa6a99e4650f75a61201b2138c5680f4.zip
CMake-f47690ecaa6a99e4650f75a61201b2138c5680f4.tar.gz
CMake-f47690ecaa6a99e4650f75a61201b2138c5680f4.tar.bz2
BUG: Prevent crash when strerror fails
Diffstat (limited to 'Source/CTest/Curl')
-rw-r--r--Source/CTest/Curl/strerror.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/CTest/Curl/strerror.c b/Source/CTest/Curl/strerror.c
index 3179dd6..fafe9ec 100644
--- a/Source/CTest/Curl/strerror.c
+++ b/Source/CTest/Curl/strerror.c
@@ -539,11 +539,20 @@ const char *Curl_strerror(struct connectdata *conn, int err)
/* this version of strerror_r() only *might* use the buffer we pass to
the function, but it always returns the error message as a pointer,
so we must copy that string unconditionally */
+ if ( !msg )
+ {
+ msg = "Unknown System Error";
+ }
strncpy(buf, msg, max);
}
#endif /* end of HAVE_GLIBC_STRERROR_R */
#else /* HAVE_STRERROR_R */
- strncpy(buf, strerror(err), max);
+ char *msg = strerror(err);
+ if ( !msg )
+ {
+ msg = "Unknown System Error";
+ }
+ strncpy(buf, msg, max);
#endif /* end of HAVE_STRERROR_R */
#endif /* end of ! Windows */