From 9555aa7a183b422100322f5cc8017faabcf45d4e Mon Sep 17 00:00:00 2001
From: phil <me@filou.se>
Date: Mon, 27 Dec 2021 15:50:50 +0100
Subject: [PATCH] sdp parse accepts trailing spaces on first line (v=0)

---
 src/core/sdp.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/core/sdp.c b/src/core/sdp.c
index b5ef7d4..2f37f7a 100644
--- a/src/core/sdp.c
+++ b/src/core/sdp.c
@@ -1391,17 +1391,17 @@ u32_t aes67_sdp_fromstr(struct aes67_sdp *sdp, u8_t *str, u32_t len, void *user_
 
     u32_t pos = 3;
 
-    // abort if no line termination
-    if (!IS_CRNL(str[pos])){
+    // skip to \n
+    while (pos < len && str[pos] != NL){
+        pos++;
+    }
+    // sanity check not beyond given string
+    if (pos >= len){
         return AES67_SDP_ERROR;
     }
-
+    // move position beyond newline
     pos++;
 
-    // if only NL skip (ie 2 chars for newline CRNL)
-    if (IS_NL(str[pos])) {
-        pos++;
-    }
 
     // reset
     aes67_sdp_init(sdp);
-- 
GitLab