diff options
| author | Clecio Jung | 2023-04-15 11:07:01 -0300 |
|---|---|---|
| committer | Clecio Jung | 2023-04-15 11:07:01 -0300 |
| commit | d7119c21fa566d2d5834cc5aa8627655ee849160 (patch) | |
| tree | 33cfea3efe3d2d282b8cb4b4241fd07e4667781f /ini_file.c | |
| parent | a33d389310a35bc181583b0f25dbf742e67295e9 (diff) | |
| download | libini-d7119c21fa566d2d5834cc5aa8627655ee849160.tar.xz libini-d7119c21fa566d2d5834cc5aa8627655ee849160.tar.zst | |
Update the README example
Diffstat (limited to 'ini_file.c')
| -rw-r--r-- | ini_file.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -211,6 +211,10 @@ static char *copy_sized_string(struct Ini_File *ini_file, const char *const size if (ini_file == NULL) { return NULL; } + /* Checks if the string fits into the maximum buffer size */ + if ((len + 1) >= STRING_ALLOCATOR_BUFFER_SIZE) { + return NULL; + } if ((ini_file->strings == NULL) || ((ini_file->string_index + len + 1) > sizeof(ini_file->strings->buffer))) { /* Insert new buffer at the beginning */ struct String_Buffer *new_strings = malloc(sizeof(struct String_Buffer)); |
