[Pkg-libvirt-commits] [libguestfs] 05/72: php: fix invalid memory access with stringlist params
Hilko Bengen
bengen at moszumanska.debian.org
Sun Apr 5 15:19:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch master
in repository libguestfs.
commit 2a81e9a5adbcf60da387b68c97df2892a79ed92f
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.
(cherry picked from commit 8e4bf5cf9e5ab5ec5d9b129450e7dd5cfa2a4117)
---
generator/php.ml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/generator/php.ml b/generator/php.ml
index a9d0e94..7f53d43 100644
--- a/generator/php.ml
+++ b/generator/php.ml
@@ -112,7 +112,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