Module: kamailio
Branch: master
Commit: 9cd07110ed59058de27c077574e4a740df068485
URL:
https://github.com/kamailio/kamailio/commit/9cd07110ed59058de27c077574e4a74…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-12T11:41:23+01:00
presence_dialoginfo: check return for sscanf()
---
Modified: src/modules/presence_dialoginfo/pidf.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9cd07110ed59058de27c077574e4a74…
Patch:
https://github.com/kamailio/kamailio/commit/9cd07110ed59058de27c077574e4a74…
---
diff --git a/src/modules/presence_dialoginfo/pidf.c
b/src/modules/presence_dialoginfo/pidf.c
index 95852379455..382045eab83 100644
--- a/src/modules/presence_dialoginfo/pidf.c
+++ b/src/modules/presence_dialoginfo/pidf.c
@@ -141,6 +141,7 @@ time_t xml_parse_dateTime(char *xml_time_str)
char h1, h2, m1, m2;
int sign = 1;
signed int timezone_diff = 0;
+ int rv = 0;
p = strptime(xml_time_str, "%F", &tm);
if(p == NULL) {
@@ -178,7 +179,8 @@ time_t xml_parse_dateTime(char *xml_time_str)
p++;
- if(sscanf(p, "%c%c:%c%c", &h1, &h2, &m1, &m2) < 0) {
+ rv = sscanf(p, "%c%c:%c%c", &h1, &h2, &m1, &m2);
+ if(rv == EOF || rv < 4) {
printf("error: failed to parse time\n");
return 0;
}