summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-04-11 16:56:32 (GMT)
committerBrad King <brad.king@kitware.com>2019-04-11 16:56:32 (GMT)
commitf0948499f6b47a7a856aef3334a8d8a38c1265d5 (patch)
tree4f2ac14d379cf7b4f57c92416593f2ef6e2c54cb /Source
parenta550e2d6e48798d342a5ba7436013c6aa6ce5151 (diff)
downloadCMake-f0948499f6b47a7a856aef3334a8d8a38c1265d5.zip
CMake-f0948499f6b47a7a856aef3334a8d8a38c1265d5.tar.gz
CMake-f0948499f6b47a7a856aef3334a8d8a38c1265d5.tar.bz2
cmSystemTools: Fix StringToULong to reject negative numbers
Fixes: #19161
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSystemTools.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index d201061..212608d 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -3023,6 +3023,12 @@ bool cmSystemTools::StringToULong(const char* str, unsigned long* value)
{
errno = 0;
char* endp;
+ while (isspace(*str)) {
+ ++str;
+ }
+ if (*str == '-') {
+ return false;
+ }
*value = strtoul(str, &endp, 10);
return (*endp == '\0') && (endp != str) && (errno == 0);
}