[libc] return -1 when v/swprintf truncate output (#245838)
Hello, this is my first pr for libc but I have done my best to read the
guidelines and policies. I look forward to making any changes or
improvements as needed :). AI Disclosure: no ai was used, but I did read
a previous pr for this issue which was later closed for being AI
generated. This change will fix #245060.
From the standard:
```
The swprintf function returns the number of wide characters written in the array, not
counting the terminating null wide character, or a negative value if an encoding error
occurred or if n or more wide characters were requested to be written.
```
```
The vswprintf function returns the number of wide characters written in the array, not
counting the terminating null wide character, or a negative value if an encoding error
occurred or if n or more wide characters were requested to be generated.
```
The change then is to simply check the length of the generated
characters against the size of the provided buffer. Besides that I added
a new type of internal error that gets turned into E2BIG, copying the
behavior from glibc and the surrounding code. I tried to change the
tests minimally so they would pass and be similar to the ones that test
overflows. I think this makes some of the tests less useful so maybe we
should find a new way to test the old behavior without truncating
output, and then add a separate test for the truncating case but I am
unsure what is best here.
Thank you for your time and advice,
Aaron