Module: kamailio
Branch: master
Commit: 34ce0de749c20e1b5a2e58fdaaca841d75622d2c
URL:
https://github.com/kamailio/kamailio/commit/34ce0de749c20e1b5a2e58fdaaca841…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-02-13T09:51:51+01:00
presence: cast to uint64_t when using time_t value
- startup time stored as unsigned int insted of signed int
---
Modified: src/modules/presence/presence.c
Modified: src/modules/presence/presence.h
Modified: src/modules/presence/presentity.c
---
Diff:
https://github.com/kamailio/kamailio/commit/34ce0de749c20e1b5a2e58fdaaca841…
Patch:
https://github.com/kamailio/kamailio/commit/34ce0de749c20e1b5a2e58fdaaca841…
---
diff --git a/src/modules/presence/presence.c b/src/modules/presence/presence.c
index d6e287c40e..599e048e4d 100644
--- a/src/modules/presence/presence.c
+++ b/src/modules/presence/presence.c
@@ -142,7 +142,7 @@ static int fixup_has_subscribers(void **param, int param_no);
int pres_counter = 0;
int pres_pid = 0;
char pres_prefix = 'a';
-int pres_startup_time = 0;
+unsigned int pres_startup_time = 0;
str pres_db_url = {0, 0};
int pres_expires_offset = 0;
int pres_cseq_offset = 0;
@@ -447,7 +447,7 @@ static int mod_init(void)
}
- pres_startup_time = (int)time(NULL);
+ pres_startup_time = (unsigned int)(uint64_t)time(NULL);
if(pres_clean_period > 0) {
if(pres_timer_mode==0) {
register_timer(ps_presentity_db_timer_clean, 0, pres_clean_period);
diff --git a/src/modules/presence/presence.h b/src/modules/presence/presence.h
index 381029184a..390aee49f8 100644
--- a/src/modules/presence/presence.h
+++ b/src/modules/presence/presence.h
@@ -73,7 +73,7 @@ extern str watchers_table;
extern int pres_counter;
extern int pres_pid;
-extern int pres_startup_time;
+extern unsigned int pres_startup_time;
extern int pres_expires_offset;
extern int pres_cseq_offset;
extern str pres_server_address;
diff --git a/src/modules/presence/presentity.c b/src/modules/presence/presentity.c
index 2ac5190495..f9131e9a4e 100644
--- a/src/modules/presence/presentity.c
+++ b/src/modules/presence/presentity.c
@@ -69,7 +69,7 @@ char *generate_ETag(int publ_count)
ERR_MEM(PKG_MEM_STR);
}
memset(etag, 0, ETAG_LEN * sizeof(char));
- size = snprintf(etag, ETAG_LEN, "%c.%d.%d.%d.%d", pres_prefix,
+ size = snprintf(etag, ETAG_LEN, "%c.%u.%d.%d.%d", pres_prefix,
pres_startup_time, pres_pid, pres_counter, publ_count);
if(size < 0) {
LM_ERR("unsuccessful snprintf\n ");