osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-msc/+/33396 )
Change subject: sdp_msg_test: fix dereference after null check
......................................................................
sdp_msg_test: fix dereference after null check
Fixes: CID#274690
Change-Id: Ic59252e4f1d4daf5f86c6b73ec951e02109df9bc
---
M tests/sdp_msg/sdp_msg_test.c
1 file changed, 17 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/96/33396/1
diff --git a/tests/sdp_msg/sdp_msg_test.c b/tests/sdp_msg/sdp_msg_test.c
index ebe8328..4798ae0 100644
--- a/tests/sdp_msg/sdp_msg_test.c
+++ b/tests/sdp_msg/sdp_msg_test.c
@@ -526,6 +526,8 @@
struct sdp_msg sdp = {};
struct sdp_audio_codec *codec;
char buf[1024];
+ const char *expect_sdp;
+
printf("\n[%d]\n", i);
rc = sdp_msg_from_sdp_str(&sdp, t->sdp);
if (rc) {
@@ -542,14 +544,15 @@
printf("SDP: %s\n", sdp_audio_codecs_to_str(&sdp.audio_codecs));
sdp_msg_to_sdp_str_buf(buf, sizeof(buf), &sdp);
- if (strcmp(buf, t->expect_sdp ? : t->sdp)) {
+ expect_sdp = t->expect_sdp ? : t->sdp;
+ if (strcmp(buf, expect_sdp)) {
int j;
ok = false;
printf("ERROR:\n");
dump_sdp(buf, "selection result: ");
- dump_sdp(t->expect_sdp, "expect result: ");
- for (j = 0; t->expect_sdp[j]; j++) {
- if (t->expect_sdp[j] != buf[j]) {
+ dump_sdp(expect_sdp, "expect result: ");
+ for (j = 0; expect_sdp[j]; j++) {
+ if (expect_sdp[j] != buf[j]) {
printf("ERROR at position %d, at:\n", j);
dump_sdp(buf + j, " mismatch: ");
break;
--
To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/33396
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic59252e4f1d4daf5f86c6b73ec951e02109df9bc
Gerrit-Change-Number: 33396
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange