diff options
| author | Justus Winter <[email protected]> | 2015-12-03 13:50:44 +0100 |
|---|---|---|
| committer | Justus Winter <[email protected]> | 2015-12-03 13:50:44 +0100 |
| commit | 68827cbba2083db40df92de1bc449a3d2d0e81ed (patch) | |
| tree | 077bc9a2e3a5aaf1df8415933a1fefea151cb8c5 /tests | |
| parent | Fix typos found by codespell. (diff) | |
| download | libgpg-error-68827cbba2083db40df92de1bc449a3d2d0e81ed.tar.gz libgpg-error-68827cbba2083db40df92de1bc449a3d2d0e81ed.zip | |
tests: Fix read past buffer.
* tests/t-poll.c (test_poll): Fix read past buffer.
--
Found using gcc and AddressSanitizer.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/t-poll.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/t-poll.c b/tests/t-poll.c index 5955d50..57cdb75 100644 --- a/tests/t-poll.c +++ b/tests/t-poll.c @@ -288,7 +288,9 @@ test_poll (void) if (!ret) { assert (nwritten <= used); - memmove (buffer, buffer + nwritten, nwritten); + /* Move the remaining data to the front of buffer. */ + memmove (buffer, buffer + nwritten, + sizeof buffer - nwritten); used -= nwritten; } ret = es_fflush (fds[1].stream); |
