mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-26 07:40:10 +01:00
[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:
parent
86d6a48952
commit
81c4594712
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue