Commit 4ba7014f89 for asterisk.org
commit 4ba7014f891369db187a221f1f0cb943ce2df0f6
Author: Sven Kube <kube@sipgate.de>
Date: Tue Mar 17 10:38:38 2026 +0100
res_audiosocket: Fix header read loop to use correct buffer offset
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.
diff --git a/res/res_audiosocket.c b/res/res_audiosocket.c
index 48bfc1f145..5b821292b4 100644
--- a/res/res_audiosocket.c
+++ b/res/res_audiosocket.c
@@ -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);