[Pkg-libvirt-commits] [libguestfs] 256/384: php: fix invalid memory access with stringlist params
Hilko Bengen
bengen at moszumanska.debian.org
Sun Mar 29 16:57:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit 8e4bf5cf9e5ab5ec5d9b129450e7dd5cfa2a4117
Author: Pino Toscano <ptoscano at redhat.com>
Date: Tue Feb 10 15:39:14 2015 +0100
php: fix invalid memory access with stringlist params
Make sure to copy the strings we add to the char** array, otherwise they
are stale pointers which we'll try to free later.
Also, properly destruct the temporary zval.
---
generator/php.ml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/generator/php.ml b/generator/php.ml
index 69f627f..28903d0 100644
--- a/generator/php.ml
+++ b/generator/php.ml
@@ -113,7 +113,8 @@ get_stringlist (zval *val)
zval t = **d;
zval_copy_ctor (&t);
convert_to_string (&t);
- ret[c] = Z_STRVAL (t);
+ ret[c] = estrndup (Z_STRVAL(t), Z_STRLEN (t));
+ zval_dtor (&t);
c++;
}
ret[c] = NULL;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list