-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overwriting terminated null character #3001
Comments
I'm not sure if I understand your proposal. Here is the original code for reference: if (c >= 0x00 and c <= 0x1f)
{
// print character c as \uxxxx
sprintf(&result[pos + 1], "u%04x", int(c));
pos += 6;
// overwrite trailing null character
result[pos] = '\\';
} The string |
Let's see what's going on if we have |
Sorry, accidentally closed the issue |
I just realized that the code you refer to is nearly 6 years old and has since been changed several times. See https://github.com/nlohmann/json/blob/develop/include/nlohmann/detail/output/serializer.hpp#L449 for the current implementation which looks much different to the previous one. |
json/src/json.hpp
Line 4684 in ec7a1d8
I think it's better to check here the size of result and do something like:
The text was updated successfully, but these errors were encountered: