[Pkg-gnupg-commit] [libgpg-error] 11/19: tests: Fix read past buffer.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Tue Dec 15 15:55:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository libgpg-error.
commit 68827cbba2083db40df92de1bc449a3d2d0e81ed
Author: Justus Winter <justus at g10code.com>
Date: Thu Dec 3 13:50:44 2015 +0100
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 at g10code.com>
---
tests/t-poll.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libgpg-error.git
More information about the Pkg-gnupg-commit
mailing list