-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Configuration
-
None
-
Storage Engines
The beleaguered WT_STRING_MATCH macro has an error when the second string is zero length.
#include <stdio.h> #include <string.h> #include <stdbool.h> #define WT_STRING_MATCH(str, bytes, len) __wt_string_match(str, bytes, len) static inline bool __wt_string_match(const char *str, const char *bytes, size_t len) { return (len == 0 || (strncmp(str, bytes, len) == 0 && str[len] == '\0')); } void main(void) { const char *nothing = ""; printf("returns %d\n", WT_STRING_MATCH("something", nothing, 0)); }
This prints 1, that is, true. In the way this macro is used, this should behave differently from memcmp, not the same.
- duplicates
-
WT-12777 Config compilation API returns invalid default value for a string based configuration
- Closed