<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18506">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">GCC12: Fixes for 16+<br><br>Most issues were in stringfields and had to do with comparing<br>a pointer to an constant/interned string with NULL. Since the<br>string was a constant, a pointer to it could never be NULL so<br>the comparison was always "true". gcc now complains about that.<br><br>There were also a few issues where determining if there was<br>enough space for a memcpy or s(n)printf which were fixed<br>by defining some of the involved variables as "volatile".<br><br>There were also a few other miscellaneous fixes.<br><br>ASTERISK-30044<br><br>Change-Id: Ia081ca1bcfb329df6487c4660aaf1944309eb570<br>---<br>M addons/Makefile<br>M apps/app_festival.c<br>M channels/chan_sip.c<br>M channels/sig_analog.c<br>M funcs/func_scramble.c<br>M include/asterisk/stringfields.h<br>M include/asterisk/strings.h<br>M main/pbx.c<br>M main/stun.c<br>M res/res_config_pgsql.c<br>M res/res_tonedetect.c<br>M tests/test_vector.c<br>12 files changed, 74 insertions(+), 46 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/addons/Makefile b/addons/Makefile</span><br><span>index ae97ffb..06360db 100644</span><br><span>--- a/addons/Makefile</span><br><span>+++ b/addons/Makefile</span><br><span>@@ -62,6 +62,10 @@</span><br><span> $(call MOD_ADD_C,chan_ooh323,$(H323SOURCE))</span><br><span> </span><br><span> ifneq ($(wildcard mp3/Makefile),)</span><br><span style="color: hsl(120, 100%, 40%);">+# At the current time, the fate of mp3 is in flux so it didn't make sense to</span><br><span style="color: hsl(120, 100%, 40%);">+# add configure/makeopts processing for array-bounds since this is the only</span><br><span style="color: hsl(120, 100%, 40%);">+# source file that needs that warning suppressed.</span><br><span style="color: hsl(120, 100%, 40%);">+mp3/layer3.o: _ASTCFLAGS+=-Wno-array-bounds</span><br><span> $(call MOD_ADD_C,format_mp3,mp3/common.c mp3/dct64_i386.c mp3/decode_ntom.c mp3/layer3.c mp3/tabinit.c mp3/interface.c)</span><br><span> </span><br><span> .PHONY: check_mp3</span><br><span>diff --git a/apps/app_festival.c b/apps/app_festival.c</span><br><span>index c18725d..5348bc7 100644</span><br><span>--- a/apps/app_festival.c</span><br><span>+++ b/apps/app_festival.c</span><br><span>@@ -433,7 +433,7 @@</span><br><span> }</span><br><span> readcache = 0;</span><br><span> writecache = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (strlen(cachedir) + strlen(MD5Hex) + 1 <= MAXFESTLEN && (usecache == -1)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (strlen(cachedir) + sizeof(MD5Hex) + 1 <= MAXFESTLEN && (usecache == -1)) {</span><br><span> snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex);</span><br><span> fdesc = open(cachefile, O_RDWR);</span><br><span> if (fdesc == -1) {</span><br><span>diff --git a/channels/chan_sip.c b/channels/chan_sip.c</span><br><span>index affd73f..bf03c5f 100644</span><br><span>--- a/channels/chan_sip.c</span><br><span>+++ b/channels/chan_sip.c</span><br><span>@@ -35420,8 +35420,8 @@</span><br><span> ast_test_status_update(test, "Unexpected result: %d != %d\n", expected_res, res); \</span><br><span> return AST_TEST_FAIL; \</span><br><span> } \</span><br><span style="color: hsl(0, 100%, 40%);">- if ((expected_start) != start) { \</span><br><span style="color: hsl(0, 100%, 40%);">- const char *e = expected_start ? expected_start : "(null)"; \</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((void *)(expected_start) != (void *)start) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *e = ((void *)expected_start != (void *)NULL) ? expected_start : "(null)"; \</span><br><span> const char *a = start ? start : "(null)"; \</span><br><span> ast_test_status_update(test, "Unexpected start: %s != %s\n", e, a); \</span><br><span> return AST_TEST_FAIL; \</span><br><span>diff --git a/channels/sig_analog.c b/channels/sig_analog.c</span><br><span>index 64f1114..ea507fe 100644</span><br><span>--- a/channels/sig_analog.c</span><br><span>+++ b/channels/sig_analog.c</span><br><span>@@ -1033,6 +1033,10 @@</span><br><span> ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);</span><br><span> c = NULL;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (c && (strlen(c) > sizeof(p->dop.dialstr) - 3 /* "Tw\0" */)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Number '%s' is longer than %d bytes\n", c, (int)sizeof(p->dop.dialstr) - 2);</span><br><span style="color: hsl(120, 100%, 40%);">+ c = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> if (c) {</span><br><span> p->dop.op = ANALOG_DIAL_OP_REPLACE;</span><br><span> snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "Tw%s", c);</span><br><span>diff --git a/funcs/func_scramble.c b/funcs/func_scramble.c</span><br><span>index a90d7a2..5fe194c 100644</span><br><span>--- a/funcs/func_scramble.c</span><br><span>+++ b/funcs/func_scramble.c</span><br><span>@@ -126,7 +126,7 @@</span><br><span> </span><br><span> if (frame->frametype == AST_FRAME_VOICE) { /* only invert voice frequencies */</span><br><span> /* Based on direction of frame, and confirm it is applicable */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(direction == AST_AUDIOHOOK_DIRECTION_READ ? &ni->rx : &ni->tx)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!(direction == AST_AUDIOHOOK_DIRECTION_READ ? ni->rx : ni->tx)) {</span><br><span> return 0;</span><br><span> }</span><br><span> /* Scramble the sample now */</span><br><span>diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h</span><br><span>index edf479d..94ba756 100644</span><br><span>--- a/include/asterisk/stringfields.h</span><br><span>+++ b/include/asterisk/stringfields.h</span><br><span>@@ -355,10 +355,11 @@</span><br><span> \retval zero on success</span><br><span> \retval non-zero on failure</span><br><span> */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #define ast_string_field_init(x, size) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __res__ = __ast_string_field_init(&(x)->__field_mgr, &(x)->__field_mgr_pool, size, __FILE__, __LINE__, __PRETTY_FUNCTION__); \</span><br><span> } \</span><br><span> __res__ ; \</span><br><span>@@ -373,7 +374,7 @@</span><br><span> #define ast_string_field_free_memory(x) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __res__ = __ast_string_field_free_memory(&(x)->__field_mgr, &(x)->__field_mgr_pool, \</span><br><span> AST_STRINGFIELD_DESTROY, __FILE__, __LINE__, __PRETTY_FUNCTION__); \</span><br><span> } \</span><br><span>@@ -400,7 +401,7 @@</span><br><span> #define ast_string_field_init_extended(x, field) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> ast_string_field *non_const = (ast_string_field *)&(x)->field; \</span><br><span> *non_const = __ast_string_field_empty; \</span><br><span> __res__ = AST_VECTOR_APPEND(&(x)->__field_mgr.string_fields, non_const); \</span><br><span>@@ -474,7 +475,7 @@</span><br><span> #define ast_string_field_ptr_set(x, ptr, data) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __res__ = ast_string_field_ptr_set_by_fields((x)->__field_mgr_pool, (x)->__field_mgr, ptr, data); \</span><br><span> } \</span><br><span> __res__; \</span><br><span>@@ -482,26 +483,28 @@</span><br><span> </span><br><span> #define __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, file, lineno, func) \</span><br><span> ({ \</span><br><span style="color: hsl(0, 100%, 40%);">- int __res__ = 0; \</span><br><span style="color: hsl(0, 100%, 40%);">- const char *__d__ = (data); \</span><br><span style="color: hsl(0, 100%, 40%);">- size_t __dlen__ = (__d__) ? strlen(__d__) + 1 : 1; \</span><br><span style="color: hsl(0, 100%, 40%);">- ast_string_field *__p__ = (ast_string_field *) (ptr); \</span><br><span style="color: hsl(0, 100%, 40%);">- ast_string_field target = *__p__; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (__dlen__ == 1) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_string_field_release_active(field_mgr_pool, *__p__); \</span><br><span style="color: hsl(0, 100%, 40%);">- *__p__ = __ast_string_field_empty; \</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((__dlen__ <= AST_STRING_FIELD_ALLOCATION(*__p__)) || \</span><br><span style="color: hsl(0, 100%, 40%);">- (!__ast_string_field_ptr_grow(&field_mgr, &field_mgr_pool, __dlen__, __p__)) || \</span><br><span style="color: hsl(0, 100%, 40%);">- (target = __ast_string_field_alloc_space(&field_mgr, &field_mgr_pool, __dlen__, file, lineno, func))) { \</span><br><span style="color: hsl(0, 100%, 40%);">- if (target != *__p__) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_string_field_release_active(field_mgr_pool, *__p__); \</span><br><span style="color: hsl(0, 100%, 40%);">- *__p__ = target; \</span><br><span style="color: hsl(0, 100%, 40%);">- } \</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy(* (void **) __p__, __d__, __dlen__); \</span><br><span style="color: hsl(0, 100%, 40%);">- } else { \</span><br><span style="color: hsl(0, 100%, 40%);">- __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- } \</span><br><span style="color: hsl(0, 100%, 40%);">- __res__; \</span><br><span style="color: hsl(120, 100%, 40%);">+ int __res__ = 0; \</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *__d__ = (data); \</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_string_field *__p__ = (ast_string_field *) (ptr); \</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_string_field target = *__p__; \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (__d__ == NULL || *__d__ == '\0') { \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_string_field_release_active(field_mgr_pool, *__p__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ *__p__ = __ast_string_field_empty; \</span><br><span style="color: hsl(120, 100%, 40%);">+ } else { \</span><br><span style="color: hsl(120, 100%, 40%);">+ size_t __dlen__ = strlen(__d__) + 1; \</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((__dlen__ <= AST_STRING_FIELD_ALLOCATION(*__p__)) || \</span><br><span style="color: hsl(120, 100%, 40%);">+ (!__ast_string_field_ptr_grow(&field_mgr, &field_mgr_pool, __dlen__, __p__)) || \</span><br><span style="color: hsl(120, 100%, 40%);">+ (target = __ast_string_field_alloc_space(&field_mgr, &field_mgr_pool, __dlen__, file, lineno, func))) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (target != *__p__) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_string_field_release_active(field_mgr_pool, *__p__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ *__p__ = target; \</span><br><span style="color: hsl(120, 100%, 40%);">+ } \</span><br><span style="color: hsl(120, 100%, 40%);">+ memcpy(* (void **) __p__, __d__, __dlen__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ } else { \</span><br><span style="color: hsl(120, 100%, 40%);">+ __res__ = -1; \</span><br><span style="color: hsl(120, 100%, 40%);">+ } \</span><br><span style="color: hsl(120, 100%, 40%);">+ } \</span><br><span style="color: hsl(120, 100%, 40%);">+ __res__; \</span><br><span> })</span><br><span> </span><br><span> #define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \</span><br><span>@@ -518,7 +521,7 @@</span><br><span> #define ast_string_field_set(x, field, data) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __res__ = ast_string_field_ptr_set(x, &(x)->field, data); \</span><br><span> } \</span><br><span> __res__; \</span><br><span>@@ -534,7 +537,7 @@</span><br><span> #define ast_string_field_ptr_build(x, ptr, fmt, args...) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \</span><br><span> &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \</span><br><span> __res__ = 0; \</span><br><span>@@ -552,7 +555,7 @@</span><br><span> #define ast_string_field_build(x, field, fmt, args...) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \</span><br><span> &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \</span><br><span> __res__ = 0; \</span><br><span>@@ -570,7 +573,7 @@</span><br><span> #define ast_string_field_ptr_build_va(x, ptr, fmt, args) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args, \</span><br><span> __FILE__, __LINE__, __PRETTY_FUNCTION__); \</span><br><span> __res__ = 0; \</span><br><span>@@ -588,7 +591,7 @@</span><br><span> #define ast_string_field_build_va(x, field, fmt, args) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(x)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(x)) != (void *)NULL) { \</span><br><span> __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args, \</span><br><span> __FILE__, __LINE__, __PRETTY_FUNCTION__); \</span><br><span> __res__ = 0; \</span><br><span>@@ -607,7 +610,7 @@</span><br><span> #define ast_string_fields_cmp(instance1, instance2) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(instance1)) != NULL && ((void *)(instance2)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(instance1)) != (void *)NULL && ((void *)(instance2)) != (void *)NULL) { \</span><br><span> __res__ = __ast_string_fields_cmp(&(instance1)->__field_mgr.string_fields, \</span><br><span> &(instance2)->__field_mgr.string_fields); \</span><br><span> } \</span><br><span>@@ -627,7 +630,7 @@</span><br><span> #define ast_string_fields_copy(copy, orig) \</span><br><span> ({ \</span><br><span> int __res__ = -1; \</span><br><span style="color: hsl(0, 100%, 40%);">- if (((void *)(copy)) != NULL && ((void *)(orig)) != NULL) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((void *)(copy)) != (void *)NULL && ((void *)(orig)) != (void *)NULL) { \</span><br><span> __res__ = __ast_string_fields_copy(((copy)->__field_mgr_pool), \</span><br><span> (struct ast_string_field_mgr *)&((copy)->__field_mgr), \</span><br><span> (struct ast_string_field_mgr *)&((orig)->__field_mgr), \</span><br><span>diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h</span><br><span>index ab46273..93983c3 100644</span><br><span>--- a/include/asterisk/strings.h</span><br><span>+++ b/include/asterisk/strings.h</span><br><span>@@ -393,11 +393,13 @@</span><br><span> AST_INLINE_API(</span><br><span> void ast_copy_string(char *dst, const char *src, size_t size),</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- while (*src && size) {</span><br><span style="color: hsl(0, 100%, 40%);">- *dst++ = *src++;</span><br><span style="color: hsl(0, 100%, 40%);">- size--;</span><br><span style="color: hsl(120, 100%, 40%);">+ volatile size_t sz = size;</span><br><span style="color: hsl(120, 100%, 40%);">+ volatile char *sp = (char *)src;</span><br><span style="color: hsl(120, 100%, 40%);">+ while (*sp && sz) {</span><br><span style="color: hsl(120, 100%, 40%);">+ *dst++ = *sp++;</span><br><span style="color: hsl(120, 100%, 40%);">+ sz--;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (__builtin_expect(!size, 0))</span><br><span style="color: hsl(120, 100%, 40%);">+ if (__builtin_expect(!sz, 0))</span><br><span> dst--;</span><br><span> *dst = '\0';</span><br><span> }</span><br><span>diff --git a/main/pbx.c b/main/pbx.c</span><br><span>index 1e08f23..3a701aa 100644</span><br><span>--- a/main/pbx.c</span><br><span>+++ b/main/pbx.c</span><br><span>@@ -1652,6 +1652,7 @@</span><br><span> #undef INC_DST_OVERFLOW_CHECK</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define MAX_EXTENBUF_SIZE 512</span><br><span> static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, struct ast_exten *e1, int findonly)</span><br><span> {</span><br><span> struct match_char *m1 = NULL;</span><br><span>@@ -1662,11 +1663,13 @@</span><br><span> int pattern = 0;</span><br><span> int idx_cur;</span><br><span> int idx_next;</span><br><span style="color: hsl(0, 100%, 40%);">- char extenbuf[512];</span><br><span style="color: hsl(120, 100%, 40%);">+ char extenbuf[MAX_EXTENBUF_SIZE];</span><br><span style="color: hsl(120, 100%, 40%);">+ volatile size_t required_space = strlen(e1->exten) + 1;</span><br><span> struct pattern_node pat_node[2];</span><br><span> </span><br><span> if (e1->matchcid) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (sizeof(extenbuf) < strlen(e1->exten) + strlen(e1->cidmatch) + 2) {</span><br><span style="color: hsl(120, 100%, 40%);">+ required_space += (strlen(e1->cidmatch) + 2 /* '/' + NULL */);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (required_space > MAX_EXTENBUF_SIZE) {</span><br><span> ast_log(LOG_ERROR,</span><br><span> "The pattern %s/%s is too big to deal with: it will be ignored! Disaster!\n",</span><br><span> e1->exten, e1->cidmatch);</span><br><span>@@ -1674,7 +1677,13 @@</span><br><span> }</span><br><span> sprintf(extenbuf, "%s/%s", e1->exten, e1->cidmatch);/* Safe. We just checked. */</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(extenbuf, e1->exten, sizeof(extenbuf));</span><br><span style="color: hsl(120, 100%, 40%);">+ if (required_space > MAX_EXTENBUF_SIZE) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+ "The pattern %s/%s is too big to deal with: it will be ignored! Disaster!\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ e1->exten, e1->cidmatch);</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(extenbuf, e1->exten, required_space);</span><br><span> }</span><br><span> </span><br><span> #ifdef NEED_DEBUG</span><br><span>diff --git a/main/stun.c b/main/stun.c</span><br><span>index 8007f3a..06e6d9f 100644</span><br><span>--- a/main/stun.c</span><br><span>+++ b/main/stun.c</span><br><span>@@ -370,7 +370,13 @@</span><br><span> st.username ? st.username : "<none>");</span><br><span> if (st.username) {</span><br><span> append_attr_string(&attr, STUN_USERNAME, st.username, &resplen, &respleft);</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(combined, sizeof(combined), "%16s%16s", st.username + 16, st.username);</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * For Google Voice, the stun username is made up of the local</span><br><span style="color: hsl(120, 100%, 40%);">+ * and remote usernames, each being fixed at 16 bytes. We have</span><br><span style="color: hsl(120, 100%, 40%);">+ * to swap the two at this point.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(combined, 17, "%16s", st.username + 16);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(combined + 16, 17, "%16s", st.username);</span><br><span> } else {</span><br><span> combined[0] = '\0';</span><br><span> }</span><br><span>diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c</span><br><span>index dbcd9e7..62a3565 100644</span><br><span>--- a/res/res_config_pgsql.c</span><br><span>+++ b/res/res_config_pgsql.c</span><br><span>@@ -1287,7 +1287,7 @@</span><br><span> res = -1;</span><br><span> } else {</span><br><span> struct ast_str *sql = ast_str_create(100);</span><br><span style="color: hsl(0, 100%, 40%);">- char fieldtype[10];</span><br><span style="color: hsl(120, 100%, 40%);">+ char fieldtype[20];</span><br><span> PGresult *result;</span><br><span> </span><br><span> if (requirements == RQ_CREATECHAR || type == RQ_CHAR) {</span><br><span>diff --git a/res/res_tonedetect.c b/res/res_tonedetect.c</span><br><span>index 45afe5b..055142b 100644</span><br><span>--- a/res/res_tonedetect.c</span><br><span>+++ b/res/res_tonedetect.c</span><br><span>@@ -367,7 +367,7 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(direction == AST_AUDIOHOOK_DIRECTION_READ ? &di->rx : &di->tx)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!(direction == AST_AUDIOHOOK_DIRECTION_READ ? di->rx : di->tx)) {</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span>diff --git a/tests/test_vector.c b/tests/test_vector.c</span><br><span>index 2dfcc60..5f6f0a5 100644</span><br><span>--- a/tests/test_vector.c</span><br><span>+++ b/tests/test_vector.c</span><br><span>@@ -48,7 +48,7 @@</span><br><span> }</span><br><span> </span><br><span> #define STRING_CMP(a, b) ({ \</span><br><span style="color: hsl(0, 100%, 40%);">- ((a) == NULL || (b) == NULL) ? -1 : (strcmp((a), (b)) == 0); \</span><br><span style="color: hsl(120, 100%, 40%);">+ ((void *)(a) == (void *)NULL || (void *)(b) == (void *)NULL) ? -1 : (strcmp((a), (b)) == 0); \</span><br><span> })</span><br><span> </span><br><span> AST_TEST_DEFINE(basic_ops)</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18506">change 18506</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18506"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: Ia081ca1bcfb329df6487c4660aaf1944309eb570 </div>
<div style="display:none"> Gerrit-Change-Number: 18506 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>