diff --git a/src/include/deepstate/DeepState.h b/src/include/deepstate/DeepState.h index 6838ac4..834d5bb 100644 --- a/src/include/deepstate/DeepState.h +++ b/src/include/deepstate/DeepState.h @@ -165,8 +165,7 @@ extern void *DeepState_ConcretizeData(void *begin, void *end); /* Assign a symbolic C string of length `len` with only chars in allowed, * if allowed is non-null */ -extern void DeepState_AssignCStr(char* str, size_t len, const char* allowed, - size_t allowed_size); +extern void DeepState_AssignCStr(char* str, size_t len, const char* allowed); /* Return a symbolic C string of length `len`. */ extern char *DeepState_CStr(size_t len); diff --git a/src/include/deepstate/DeepState.hpp b/src/include/deepstate/DeepState.hpp index d9f148d..cb27062 100644 --- a/src/include/deepstate/DeepState.hpp +++ b/src/include/deepstate/DeepState.hpp @@ -472,10 +472,10 @@ struct Comparer { }; /* Like DeepState_AssignCStr, but Pumps through possible string sizes. */ -inline static void DeepState_AssignCStrMax(char* str, size_t max_len, const char* allowed, - size_t allowed_size) { +inline static void DeepState_AssignCStrMax(char* str, size_t max_len, + const char* allowed) { uint32_t size = DeepState_UIntInRange(0, max_len); - DeepState_AssignCStr(str, Pump(size, max_len), allowed, allowed_size); + DeepState_AssignCStr(str, Pump(size, max_len), allowed); } /* Like DeepState_CStr, but Pumps through possible string sizes. */ diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 6f2860a..5d81f2b 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -176,14 +176,14 @@ void *DeepState_ConcretizeData(void *begin, void *end) { } /* Assign a symbolic C string of length `len`. */ -void DeepState_AssignCStr(char* str, size_t len, const char* allowed, - size_t allowed_size) { +void DeepState_AssignCStr(char* str, size_t len, const char* allowed) { if (SIZE_MAX == len) { DeepState_Abandon("Can't create an SIZE_MAX-length string."); } if (NULL == str) { DeepState_Abandon("Attempted to populate null pointer."); } + uint32_t allowed_size = strlen(allowed); for (int i = 0; i < len; i++) { str[i] = allowed[DeepState_UIntInRange(0, allowed_size)]; }