aboutsummaryrefslogtreecommitdiff
path: root/ini_file.c
diff options
context:
space:
mode:
authorClecio Jung2023-04-15 11:07:01 -0300
committerClecio Jung2023-04-15 11:07:01 -0300
commitd7119c21fa566d2d5834cc5aa8627655ee849160 (patch)
tree33cfea3efe3d2d282b8cb4b4241fd07e4667781f /ini_file.c
parenta33d389310a35bc181583b0f25dbf742e67295e9 (diff)
downloadlibini-d7119c21fa566d2d5834cc5aa8627655ee849160.tar.xz
libini-d7119c21fa566d2d5834cc5aa8627655ee849160.tar.zst
Update the README example
Diffstat (limited to 'ini_file.c')
-rw-r--r--ini_file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ini_file.c b/ini_file.c
index a18473e..e07b9b1 100644
--- a/ini_file.c
+++ b/ini_file.c
@@ -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));