summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2015-12-03 13:50:44 +0100
committerJustus Winter <justus@g10code.com>2015-12-03 13:50:44 +0100
commit68827cbba2083db40df92de1bc449a3d2d0e81ed (patch)
tree077bc9a2e3a5aaf1df8415933a1fefea151cb8c5 /tests
parentee0568476506e54349a38d4bb34bba5635097279 (diff)
downloadlibgpg-error-68827cbba2083db40df92de1bc449a3d2d0e81ed.tar.gz
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 <justus@g10code.com>
Diffstat (limited to 'tests')
-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);