summaryrefslogtreecommitdiff
path: root/libhfcommon
diff options
context:
space:
mode:
authorplusun <tomsun.0.7@gmail.com>2018-06-29 11:20:20 +0000
committerplusun <tomsun.0.7@gmail.com>2018-06-29 11:20:20 +0000
commit05c67204c21a71d78311a6c12c0d2daad016ca78 (patch)
tree55b22478617a9926a47354600c025b055b3223d1 /libhfcommon
parentd4fe83cd3498a9281e83c40c89d1c3f8d3fd1b11 (diff)
downloadhonggfuzz-05c67204c21a71d78311a6c12c0d2daad016ca78.tar.gz
Fix compatibility issues with NetBSD.
1. Using -pthread instead of -lpthread flag 2. Add install option for make 3. Convert char type to unsigned char type before calling isdigit(3) and tolower(3). Because according to the ctype(3) man page of NetBSD, the parameter of these functions should be representable as unsigned char to avoid undefined behaviors.
Diffstat (limited to 'libhfcommon')
-rw-r--r--libhfcommon/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libhfcommon/util.c b/libhfcommon/util.c
index 2fc7f22a..4adb16d7 100644
--- a/libhfcommon/util.c
+++ b/libhfcommon/util.c
@@ -284,11 +284,11 @@ int64_t fastArray64Search(uint64_t* array, size_t arraySz, uint64_t key) {
}
bool util_isANumber(const char* s) {
- if (!isdigit(s[0])) {
+ if (!isdigit((unsigned char)s[0])) {
return false;
}
for (int i = 0; s[i]; s++) {
- if (!isdigit(s[i]) && s[i] != 'x') {
+ if (!isdigit((unsigned char)s[i]) && s[i] != 'x') {
return false;
}
}