[Pkg-gnupg-commit] [gnupg2] 76/160: gpgscm: Fix reallocating string ports.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Fri Jul 15 09:36:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch upstream
in repository gnupg2.
commit 5003caa8fdc80afd5748835c06621014f83e6ec4
Author: Justus Winter <justus at g10code.com>
Date: Thu Jun 30 12:45:15 2016 +0200
gpgscm: Fix reallocating string ports.
* tests/gpgscm/scheme.c (realloc_port_string): Use memcpy because
Scheme strings may contain 0s.
Signed-off-by: Justus Winter <justus at g10code.com>
---
tests/gpgscm/scheme.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 5f2f205..0a76205 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -1620,12 +1620,13 @@ static void backchar(scheme *sc, int c) {
static int realloc_port_string(scheme *sc, port *p)
{
char *start=p->rep.string.start;
+ size_t old_size = p->rep.string.past_the_end - start;
size_t new_size=p->rep.string.past_the_end-start+1+BLOCK_SIZE;
char *str=sc->malloc(new_size);
if(str) {
memset(str,' ',new_size-1);
str[new_size-1]='\0';
- strcpy(str,start);
+ memcpy(str, start, old_size);
p->rep.string.start=str;
p->rep.string.past_the_end=str+new_size-1;
p->rep.string.curr-=start-str;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list