Summary: Fixed an implicit definition warning by including <string.h>. Also fixed run-time assertions that the return value of strxfrm_l calls is less than the buffer size by increasing the size of the referenced buffer.
Reviewers: morehouse
Reviewed By: morehouse
Subscribers: dberris, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D83593
extern "C" decltype(strxfrm_l) __strxfrm_l;
int main(void) {
- char q[10];
+ char q[100];
locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0);
size_t n = __strxfrm_l(q, "qwerty", sizeof(q), loc);
assert(n < sizeof(q));
#include <assert.h>
#include <locale.h>
-#include <wchar.h>
+#include <string.h>
int main(int argc, char **argv) {
char q[10];
size_t n = strxfrm(q, "abcdef", sizeof(q));
assert(n < sizeof(q));
- char q2[10];
+ char q2[100];
locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0);
- n = strxfrm_l(q2, L"qwerty", sizeof(q), loc);
+ n = strxfrm_l(q2, "qwerty", sizeof(q2), loc);
assert(n < sizeof(q2));
freelocale(loc);