Skip to content

Commit

Permalink
jabber: Fix off-by-one strncpy() error
Browse files Browse the repository at this point in the history
warning: ‘__builtin_strncpy’ output truncated before terminating nul
copying as many bytes from a string as its length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bo...
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
xjab_wlist.c: In function ‘xj_wlist_set_aliases’:
xjab_wlist.c:455:34: note: length computed here
  455 |   i = jwl->aliases->proxy->len = strlen(pa);
      |                                  ^~~~~~~~~~

(cherry picked from commit 2d98eef)
  • Loading branch information
liviuchircu committed Jul 21, 2021
1 parent df0a145 commit a79e6c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/jabber/xjab_wlist.c
Expand Up @@ -470,7 +470,7 @@ int xj_wlist_set_aliases(xj_wlist jwl, char *als, char *jd, char *pa)
strncpy(p0, "sip:", 5);
p0 += 4;
}
strncpy(p0, pa, i);
strncpy(p0, pa, i+1);
#ifdef XJ_EXTRA_DEBUG
LM_DBG("outbound proxy=[%.*s]\n",
jwl->aliases->proxy->len, jwl->aliases->proxy->s);
Expand Down

0 comments on commit a79e6c6

Please sign in to comment.