aboutsummaryrefslogtreecommitdiffstats
path: root/encoding.c
diff options
context:
space:
mode:
authorIgor Zlatkovic <igor@src.gnome.org>2003-03-08 13:29:24 +0000
committerIgor Zlatkovic <igor@src.gnome.org>2003-03-08 13:29:24 +0000
commit73267db52dc7917dbed341d874c7f45255e5b9ab (patch)
tree622e88782a529dfde0ae1345dacaaeef0b0a8ef0 /encoding.c
parent42f12e99d17a2979d26b6b2237b21a096c0e98b6 (diff)
downloadandroid_external_libxml2-73267db52dc7917dbed341d874c7f45255e5b9ab.tar.gz
android_external_libxml2-73267db52dc7917dbed341d874c7f45255e5b9ab.tar.bz2
android_external_libxml2-73267db52dc7917dbed341d874c7f45255e5b9ab.zip
applied Gennady's patch against buffer overrun
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/encoding.c b/encoding.c
index 3ac35fd3..de55e2e0 100644
--- a/encoding.c
+++ b/encoding.c
@@ -2194,6 +2194,9 @@ retry:
written = out->size - out->use;
+ if (written > 0)
+ written--; /* Gennady: count '/0' */
+
/*
* First specific handling of in = NULL, i.e. the initialization call
*/
@@ -2202,8 +2205,10 @@ retry:
if (handler->output != NULL) {
ret = handler->output(&out->content[out->use], &written,
NULL, &toconv);
- out->use += written;
- out->content[out->use] = 0;
+ if (ret == 0) { /* Gennady: check return value */
+ out->use += written;
+ out->content[out->use] = 0;
+ }
}
#ifdef LIBXML_ICONV_ENABLED
else if (handler->iconv_out != NULL) {