Module: kamailio Branch: master Commit: e50ab7c5ea3361dded7a80d0fcd197edc45c2fe0 URL: https://github.com/kamailio/kamailio/commit/e50ab7c5ea3361dded7a80d0fcd197edc45c2fe0
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-07-05T18:26:21+02:00 core: set a size limit for str list append --- Modified: src/core/str_list.c --- Diff: https://github.com/kamailio/kamailio/commit/e50ab7c5ea3361dded7a80d0fcd197edc45c2fe0.diff Patch: https://github.com/kamailio/kamailio/commit/e50ab7c5ea3361dded7a80d0fcd197edc45c2fe0.patch --- diff --git a/src/core/str_list.c b/src/core/str_list.c index 211e3c1552c..1a20171587b 100644 --- a/src/core/str_list.c +++ b/src/core/str_list.c @@ -32,6 +32,9 @@ #include "str_list.h" +/* 16 * 1024 * 1024 */ +#define STR_LIST_MAX_SIZE 16777216 + /** * @brief Add a new allocated list element to an existing list * @@ -47,6 +50,13 @@ struct str_list *append_str_list( char *s, int len, struct str_list **last, int *total) { struct str_list *nv; + + if(len < 0 || total == NULL || *total > STR_LIST_MAX_SIZE - len) { + LM_ERR("invalid params or too large str list: total=%d len=%d\n", + (total != NULL) ? *total : -1, len); + return NULL; + } + nv = pkg_malloc(sizeof(struct str_list)); if(!nv) { PKG_MEM_ERROR; _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
