aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2015-12-03 12:50:44 +0000
committerJustus Winter <[email protected]>2015-12-03 12:50:44 +0000
commit68827cbba2083db40df92de1bc449a3d2d0e81ed (patch)
tree077bc9a2e3a5aaf1df8415933a1fefea151cb8c5
parentFix typos found by codespell. (diff)
downloadlibgpg-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]>
-rw-r--r--tests/t-poll.c4
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);