[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.)
This commit is contained in:
Chris Wilson 2009-08-06 23:41:11 +01:00
parent 86d6a48952
commit 81c4594712

View file

@ -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