From 537a40b4745099f3265242377c39057a680fc3ee Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 15 Dec 2017 10:14:35 +0100 Subject: [PATCH 1/5] sms: fix gcc 7 warning #1369 > CC (gcc) [M sms.so] libsms_modem.o > libsms_modem.c: In function 'initmodem': > libsms_modem.c:230:36: warning: '%s' directive writing up to 128 bytes into a region of size 91 [-Wformat-overflow=] > clen=sprintf(command,"AT+CPIN=\"%s\"\r",mdm->pin); > ^~ > libsms_modem.c:230:8: note: 'sprintf' output between 12 and 140 bytes into a destination of size 100 > clen=sprintf(command,"AT+CPIN=\"%s\"\r",mdm->pin); > ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- src/modules/sms/libsms_modem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/sms/libsms_modem.c b/src/modules/sms/libsms_modem.c index 7bf702f6c7b..5093d28ee2c 100644 --- a/src/modules/sms/libsms_modem.c +++ b/src/modules/sms/libsms_modem.c @@ -213,7 +213,7 @@ int setmodemparams( struct modem *mdm ) int initmodem(struct modem *mdm, cds_report cds_report_f) { - char command[100]; + char command[MAX_CHAR_BUF+12]; char answer[100]; int retries=0; int success=0; From ea056fe4cc4c7b0dce9aaa1423d2fa3d89804b69 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 15 Dec 2017 10:35:55 +0100 Subject: [PATCH 2/5] uac: fix gcc 7 warning > CC (gcc) [M uac.so] uac_reg.o > uac_reg.c: In function 'reg_ht_add': > uac_reg.c:558:81: warning: ?: using integer constants in boolean context [-Wint-in-bool-context] > uac_reg.c:502:13: > p = p + ((bsize)?(bsize):(dst)->len) + 1; \ > ~~~~~~~ > uac_reg.c:558:81: > reg_copy_shm(&nr->callid, &str_empty, reg_keep_callid ? UAC_REG_TM_CALLID_SIZE : 0); > uac_reg.c:502:14: note: in definition of macro 'reg_copy_shm' > p = p + ((bsize)?(bsize):(dst)->len) + 1; \ > ^~~~~ --- src/modules/uac/uac_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/uac/uac_reg.c b/src/modules/uac/uac_reg.c index d85d51c6a08..4b636a5891b 100644 --- a/src/modules/uac/uac_reg.c +++ b/src/modules/uac/uac_reg.c @@ -499,7 +499,7 @@ int reg_ht_add_byuser(reg_uac_t *reg) strncpy((dst)->s, (src)->s, (src)->len); \ (dst)->len = (src)->len; \ (dst)->s[(dst)->len] = '\0'; \ - p = p + ((bsize)?(bsize):(dst)->len) + 1; \ + p = p + ((bsize)!=0?(bsize):(dst)->len) + 1; \ } \ } while(0); From 35b3d3c32d775ccea28f36d81a0b84e4a168db89 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 15 Dec 2017 10:44:26 +0100 Subject: [PATCH 3/5] auth_radius: fix gcc 7 warning > CC (gcc) [M auth_radius.so] sterman.o > sterman.c: In function 'extract_avp': > sterman.c:78:61: warning: comparison between pointer and zero character constant [-Wpointer-compare] > if(!q && p == vp->strvalue && vp->strvalue + sizeof(char) != '\0') { > ^~ > sterman.c:78:33: note: did you mean to dereference the pointer? > if(!q && p == vp->strvalue && vp->strvalue + sizeof(char) != '\0') { > ^ --- src/modules/auth_radius/sterman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/auth_radius/sterman.c b/src/modules/auth_radius/sterman.c index db50b39df62..25eac9c9f57 100644 --- a/src/modules/auth_radius/sterman.c +++ b/src/modules/auth_radius/sterman.c @@ -75,7 +75,7 @@ static inline int extract_avp( if(vp->attribute == attrs[A_SIP_AVP].v && vp->type == PW_TYPE_STRING) { p = strchr(vp->strvalue, '#'); q = strchr(vp->strvalue, ':'); - if(!q && p == vp->strvalue && vp->strvalue + sizeof(char) != '\0') { + if(!q && p == vp->strvalue && *(vp->strvalue + sizeof(char)) != '\0') { r = p; r = strchr(r++, '#'); } else From 8994daba2b60bf020f982f108ab560f9aa68723f Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 15 Dec 2017 10:50:58 +0100 Subject: [PATCH 4/5] xmpp: fix gcc 7 warnings > CC (gcc) [M xmpp.so] xode.o > xode.c: In function 'xode_get_tag': > xode.c:346:77: warning: comparison between pointer and zero character constant [-Wpointer-compare] > if(parent == NULL || parent->firstchild == NULL || name == NULL || name == '\0') return NULL; > ^~ > xode.c:346:72: note: did you mean to dereference the pointer? > if(parent == NULL || parent->firstchild == NULL || name == NULL || name == '\0') return NULL; > ^ > CC (gcc) [M xmpp.so] xstream.o > xstream.c: In function '_xode_put_expatattribs': > xstream.c:34:20: warning: comparison between pointer and zero character constant [-Wpointer-compare] > while (atts[i] != '\0') > ^~ > xstream.c:34:12: note: did you mean to dereference the pointer? > while (atts[i] != '\0') > ^ > CC (gcc) [M xmpp.so] xode_from.o > xode_from.c: In function '_xode_put_expatattribs': > xode_from.c:35:20: warning: comparison between pointer and zero character constant [-Wpointer-compare] > while (atts[i] != '\0') > ^~ > xode_from.c:35:12: note: did you mean to dereference the pointer? > while (atts[i] != '\0') > ^ --- src/modules/xmpp/xode.c | 2 +- src/modules/xmpp/xode_from.c | 2 +- src/modules/xmpp/xstream.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/xmpp/xode.c b/src/modules/xmpp/xode.c index 4909f6345e1..8cc086aa3fe 100644 --- a/src/modules/xmpp/xode.c +++ b/src/modules/xmpp/xode.c @@ -343,7 +343,7 @@ xode xode_get_tag(xode parent, const char* name) char *str, *slash, *qmark, *equals; xode step, ret; - if(parent == NULL || parent->firstchild == NULL || name == NULL || name == '\0') return NULL; + if(parent == NULL || parent->firstchild == NULL || name == NULL || *name == '\0') return NULL; if(strstr(name, "/") == NULL && strstr(name,"?") == NULL) return _xode_search(parent->firstchild, name, XODE_TYPE_TAG); diff --git a/src/modules/xmpp/xode_from.c b/src/modules/xmpp/xode_from.c index 8a78f4ba4da..60d49fa0ca5 100644 --- a/src/modules/xmpp/xode_from.c +++ b/src/modules/xmpp/xode_from.c @@ -32,7 +32,7 @@ static void _xode_put_expatattribs(xode current, const char **atts) { int i = 0; if (atts == NULL) return; - while (atts[i] != '\0') + while (*(atts[i]) != '\0') { xode_put_attrib(current, atts[i], atts[i+1]); i += 2; diff --git a/src/modules/xmpp/xstream.c b/src/modules/xmpp/xstream.c index b4367b3aa1a..41a6c1e3861 100644 --- a/src/modules/xmpp/xstream.c +++ b/src/modules/xmpp/xstream.c @@ -31,7 +31,7 @@ static void _xode_put_expatattribs(xode owner, const char** atts) { int i = 0; if (atts == NULL) return; - while (atts[i] != '\0') + while (*(atts[i]) != '\0') { xode_put_attrib(owner, atts[i], atts[i+1]); i += 2; From 0ea71ce3cdfb1bcd837f96d8e36e1b296f24a9d6 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 15 Dec 2017 11:16:11 +0100 Subject: [PATCH 5/5] db_mongodb: fix deprecation warning Since 1.5.0 mongoc_collection_find() is deprecated > http://mongoc.org/libmongoc/1.5.0/mongoc_collection_find.html --- src/modules/db_mongodb/mongodb_dbase.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/db_mongodb/mongodb_dbase.c b/src/modules/db_mongodb/mongodb_dbase.c index 048d71cdd43..57f11dc9300 100644 --- a/src/modules/db_mongodb/mongodb_dbase.c +++ b/src/modules/db_mongodb/mongodb_dbase.c @@ -919,10 +919,14 @@ int db_mongodb_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op } mgcon->nrcols = _nc; } + #if MONGOC_CHECK_VERSION(1, 5, 0) + mgcon->cursor = mongoc_collection_find_with_opts (mgcon->collection, + seldoc, mgcon->colsdoc, NULL); + #else mgcon->cursor = mongoc_collection_find (mgcon->collection, MONGOC_QUERY_NONE, 0, 0, 0, seldoc, mgcon->colsdoc, NULL); - + #endif if(!_r) { goto done; }