Fix mbsrtowcs(3) src param for finished string.
A mistake I made while cleaning this up the first time through.
mbstrtowcs(3) sets the src param to null if it finishes the string.
Change-Id: I6263646e25d9537043b7025fd1dd6ae195f365e2
diff --git a/libc/bionic/wchar.cpp b/libc/bionic/wchar.cpp
index 438ce03..524ba07 100644
--- a/libc/bionic/wchar.cpp
+++ b/libc/bionic/wchar.cpp
@@ -84,6 +84,7 @@
if (static_cast<uint8_t>((*src)[i]) < 0x80) {
// Fast path for plain ASCII characters.
if ((*src)[i] == '\0') {
+ *src = nullptr;
return reset_and_return(o, state);
}
r = 1;
@@ -96,6 +97,7 @@
return reset_and_return_illegal(EILSEQ, state);
}
if (r == 0) {
+ *src = nullptr;
return reset_and_return(o, state);
}
}
@@ -118,7 +120,8 @@
dst[o] = (*src)[i];
r = 1;
if ((*src)[i] == '\0') {
- break;
+ *src = nullptr;
+ return reset_and_return(o, state);
}
} else {
r = mbrtowc(dst + o, *src + i, nmc - i, state);