Module: kamailio Branch: master Commit: 7c6d17eb1d72760df0751d5ad6549383c51729ac URL: https://github.com/kamailio/kamailio/commit/7c6d17eb1d72760df0751d5ad6549383c51729ac
Author: Xenofon Karamanos <[email protected]> Committer: Xenofon Karamanos <[email protected]> Date: 2026-05-04T15:14:31Z lost: enhance lost_parse_geo to check for truncation of coordinates --- Modified: src/modules/lost/utilities.c --- Diff: https://github.com/kamailio/kamailio/commit/7c6d17eb1d72760df0751d5ad6549383c51729ac.diff Patch: https://github.com/kamailio/kamailio/commit/7c6d17eb1d72760df0751d5ad6549383c51729ac.patch --- diff --git a/src/modules/lost/utilities.c b/src/modules/lost/utilities.c index 2e88a34742f..f3af76dce34 100644 --- a/src/modules/lost/utilities.c +++ b/src/modules/lost/utilities.c @@ -1026,13 +1026,21 @@ int lost_parse_geo(xmlNodePtr node, p_lost_loc_t loc) return -1; } - scan = sscanf(content, "%s %s %s", bufLat, bufLon, bufAlt); + scan = sscanf(content, "%127s %127s %127s", bufLat, bufLon, bufAlt); xmlFree(content); if(scan < 2) { LM_WARN("invalid pos element\n"); return -1; } + + /* Check for truncation: if any field reached max width (127), it was likely truncated */ + if((strlen(bufLat) >= 127) || (strlen(bufLon) >= 127) + || (strlen(bufAlt) >= 127)) { + LM_WARN("pos element contains oversized coordinates (truncation " + "detected)\n"); + } + /* latitude */ len = strlen((char *)bufLat); loc->latitude = (char *)pkg_malloc(len + 1); _______________________________________________ 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!
