X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=net%2Ffreeswitch-stable%2Fpatches%2F400-switch_core_media-fix-stringop-truncation.patch;fp=net%2Ffreeswitch-stable%2Fpatches%2F400-switch_core_media-fix-stringop-truncation.patch;h=607df68bd05fdad0f84bec3d65149d2820a3deee;hb=13699a5010be568cb4dda2cf035c543ae0db3597;hp=0000000000000000000000000000000000000000;hpb=16bad9e04dcff392e9a92eea005127c06dfebd9c;p=feed%2Ftelephony.git diff --git a/net/freeswitch-stable/patches/400-switch_core_media-fix-stringop-truncation.patch b/net/freeswitch-stable/patches/400-switch_core_media-fix-stringop-truncation.patch new file mode 100644 index 0000000..607df68 --- /dev/null +++ b/net/freeswitch-stable/patches/400-switch_core_media-fix-stringop-truncation.patch @@ -0,0 +1,32 @@ +commit e114c6382e68824d4498f62562714860d20804e2 +Author: Sebastian Kemper +Date: Sun Apr 14 19:11:58 2019 +0200 + + FS-11783: [core] quiet gcc truncation warning + + With -Wstringop-truncation gcc warns about calls to bounded string + manipulation function "strncpy" that may either truncate the copied + string or leave the destination unchanged. To avoid the warning when the + result is not expected to be NUL-terminated, it is suggested to call + "memcpy" instead. + + src/switch_core_media.c: In function 'switch_core_media_patch_sdp': + src/switch_core_media.c:11854:4: error: 'strncpy' output truncated before terminating nul copying 2 bytes from a string of the same length [-Werror=stringop-truncation] + strncpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + This commit follows gcc's recommendation. + + Signed-off-by: Sebastian Kemper + +--- a/src/switch_core_media.c ++++ b/src/switch_core_media.c +@@ -11918,7 +11918,7 @@ SWITCH_DECLARE(void) switch_core_media_p + strncpy(q, p, 7); + p += 7; + q += 7; +- strncpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2); ++ memcpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2); + p +=2; + q +=2; + strncpy(q, a_engine->adv_sdp_ip, strlen(a_engine->adv_sdp_ip));