summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-06 23:41:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-06 23:47:44 +0100
commit81c4594712843abca188a33c1edfb70fa6c5a0d9 (patch)
tree1d76803a0d659362e6b4b0bdc98dd190c49d2264 /util
parent86d6a489527d125e739aa5a6d17893bb44977010 (diff)
[script] Ensure strings are nul terminated
Infrequently, but, for example, handling glyph strings, we require the string to be nul terminated. (Otherwise an error occurs, which was previously compounded by a drastic leak.)
Diffstat (limited to 'util')
-rw-r--r--util/cairo-script/cairo-script-scanner.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cairo-script/cairo-script-scanner.c b/util/cairo-script/cairo-script-scanner.c
index fb2ce9a9..adb61385 100644
--- a/util/cairo-script/cairo-script-scanner.c
+++ b/util/cairo-script/cairo-script-scanner.c
@@ -683,11 +683,12 @@ string_read (csi_t *ctx, csi_scanner_t *scan, csi_file_t *src, int len, csi_obje
{
csi_status_t status;
- status = csi_string_new (ctx, obj, NULL, len);
+ status = csi_string_new (ctx, obj, NULL, len + 1);
if (_csi_unlikely (status))
longjmp (scan->jmpbuf, status);
scan_read (scan, src, obj->datum.string->string, len);
+ obj->datum.string->string[len] = '\0';
}
#if WORDS_BIGENDIAN