]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_audiosocket: Fix header read loop to use correct buffer offset
authorSven Kube <kube@sipgate.de>
Tue, 17 Mar 2026 09:38:38 +0000 (10:38 +0100)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Wed, 18 Mar 2026 14:38:19 +0000 (14:38 +0000)
The PR #1522 introduced the header read loop for audiosocket packets
which does not handle partial header reads correctly. This commit
adds the missing buffer offsets.

res/res_audiosocket.c

index 48bfc1f14521bf8bb1d610c4a8a6623f30f48d02..5b821292b47092c4b4ecd40b36fb366336bbe7c0 100644 (file)
@@ -298,7 +298,7 @@ struct ast_frame *ast_audiosocket_receive_frame_with_hangup(const int svc,
        }
 
        while (i < 3) {
-               n = read(svc, header, 3);
+               n = read(svc, header + i, 3 - i);
                if (n == -1) {
                        if (errno == EAGAIN || errno == EWOULDBLOCK) {
                                int poll_result = ast_wait_for_input(svc, 5);