Skip to content

Commit

Permalink
Fixed strcasestr()
Browse files Browse the repository at this point in the history
  • Loading branch information
iskraman committed Sep 25, 2022
1 parent 46364c6 commit 933a137
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ 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(strcasestr(a->value, "sha-256 ") == a->value) {
rhashing = g_strdup("sha-256");
rfingerprint = g_strdup(a->value + strlen("sha-256 "));
} 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 "));
} else {
/* FIXME We should handle this somehow anyway... OpenSSL supports them all */
JANUS_LOG(LOG_WARN, "[%"SCNu64"] Hashing algorithm not the one we expected (sha-256/sha-1), *NOT* cool\n", handle->handle_id);
}
if(!strncasecmp(a->value, "sha-256", strlen("sha-256"))) {
rhashing = g_strdup("sha-256");
rfingerprint = g_strdup(a->value + strlen("sha-256 "));
} else if(!strncasecmp(a->value, "sha-1", strlen("sha-1"))) {
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 "));
} else {
/* FIXME We should handle this somehow anyway... OpenSSL supports them all */
JANUS_LOG(LOG_WARN, "[%"SCNu64"] Hashing algorithm not the one we expected (sha-256/sha-1), *NOT* cool\n", handle->handle_id);
}
} else if(!strcasecmp(a->name, "ice-ufrag")) {
JANUS_LOG(LOG_VERB, "[%"SCNu64"] ICE ufrag (global): %s\n", handle->handle_id, a->value);
ruser = g_strdup(a->value);
Expand Down

0 comments on commit 933a137

Please sign in to comment.