From 9f5a3e38797dd583cc532ab01cdfc8e02cfba523 Mon Sep 17 00:00:00 2001 From: "Christophe.Roudet" Date: Fri, 21 Oct 2022 11:06:28 -0400 Subject: [PATCH] Revert "Replace non-portable strcasestr() with strncasecmp() (#3076)" This reverts commit 78da5c5beb3d15a26130a5fc329f3d10538c77b0. --- src/sdp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdp.c b/src/sdp.c index 2e78f3184f6..101b91af544 100644 --- a/src/sdp.c +++ b/src/sdp.c @@ -161,10 +161,10 @@ int janus_sdp_process_remote(void *ice_handle, janus_sdp *remote_sdp, gboolean r if(a && a->name && a->value) { if(!strcasecmp(a->name, "fingerprint")) { JANUS_LOG(LOG_VERB, "[%"SCNu64"] Fingerprint (global) : %s\n", handle->handle_id, a->value); - if(!strncasecmp(a->value, "sha-256 ", strlen("sha-256 "))) { + if(strcasestr(a->value, "sha-256 ") == a->value) { rhashing = g_strdup("sha-256"); rfingerprint = g_strdup(a->value + strlen("sha-256 ")); - } else if(!strncasecmp(a->value, "sha-1 ", strlen("sha-1 "))) { + } else if(strcasestr(a->value, "sha-1 ") == a->value) { JANUS_LOG(LOG_WARN, "[%"SCNu64"] Hashing algorithm not the one we expected (sha-1 instead of sha-256), but that's ok\n", handle->handle_id); rhashing = g_strdup("sha-1"); rfingerprint = g_strdup(a->value + strlen("sha-1 ")); @@ -349,12 +349,12 @@ int janus_sdp_process_remote(void *ice_handle, janus_sdp *remote_sdp, gboolean r } } else if(!strcasecmp(a->name, "fingerprint")) { JANUS_LOG(LOG_VERB, "[%"SCNu64"] Fingerprint (local) : %s\n", handle->handle_id, a->value); - if(!strncasecmp(a->value, "sha-256 ", strlen("sha-256 "))) { + if(strcasestr(a->value, "sha-256 ") == a->value) { g_free(rhashing); /* FIXME We're overwriting the global one, if any */ rhashing = g_strdup("sha-256"); g_free(rfingerprint); /* FIXME We're overwriting the global one, if any */ rfingerprint = g_strdup(a->value + strlen("sha-256 ")); - } else if(!strncasecmp(a->value, "sha-1 ", strlen("sha-1 "))) { + } else if(strcasestr(a->value, "sha-1 ") == a->value) { JANUS_LOG(LOG_WARN, "[%"SCNu64"] Hashing algorithm not the one we expected (sha-1 instead of sha-256), but that's ok\n", handle->handle_id); g_free(rhashing); /* FIXME We're overwriting the global one, if any */ rhashing = g_strdup("sha-1");