]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
sig_analog: Fix truncated buffer copy
authorNaveen Albert <asterisk@phreaknet.org>
Sun, 24 Oct 2021 11:55:50 +0000 (11:55 +0000)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Mon, 8 Nov 2021 19:08:55 +0000 (13:08 -0600)
Fixes compiler warning caused by a truncated copy of the ANI2 into a
buffer of size 10. This could prevent the null terminator from being
copied if the copy value exceeds the size of the buffer. This increases
the buffer size to 101 to ensure there is no way for truncation to occur.

ASTERISK-29702 #close

Change-Id: Ief9052212952840fa44de6463b8699fdb3e163d0

channels/sig_analog.c

index 5bb5649b78c7310ad3af91d940b2086079f23bba..1af56e7451c233a7648cde8b2ceda1ee6d98fa2c 100644 (file)
@@ -1967,7 +1967,7 @@ static void *__analog_ss_thread(void *data)
                         * this as a complete spill for the purposes of setting anistart */
                        if ((res > 0) || (strlen(anibuf) >= 2)) {
                                char anistart[2] = "X";
-                               char f[10] = {0};
+                               char f[101] = {0};
                                if (strchr("#ABC", anibuf[strlen(anibuf) - 1])) {
                                        anistart[0] = anibuf[strlen(anibuf) - 1];
                                        anibuf[strlen(anibuf) - 1] = 0;