Commit acaafa4
pythongh-156939: Fix struct.pack('0p', bytes) (pythonGH-157071)
If the Pascal string is empty (size=0), do not write the size prefix.
Previously, a NUL byte was written outsize the buffer (buffer
overflow). In practice, the write remains into allocated memory
and is silently ignored: no memory is corrupted.
(cherry picked from commit 23525c9)
Co-authored-by: Victor Stinner <vstinner@python.org>1 parent 3d16dc6 commit acaafa4
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2395 | 2395 | | |
2396 | 2396 | | |
2397 | 2397 | | |
2398 | | - | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
2399 | 2401 | | |
2400 | 2402 | | |
2401 | 2403 | | |
| |||
0 commit comments