Skip to content

Commit

Permalink
make safe http_schemes.c
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Nov 20, 2023
1 parent a54820f commit 3275eda
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/supplemental/http/http_schemes.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ static struct {
const char *
nni_http_stream_scheme(const char *upper)
{
for (int i = 0; http_schemes[i].upper != NULL; i++) {
if (strcmp(http_schemes[i].upper, upper) == 0) {
return (http_schemes[i].lower);
}
if (upper != NULL) {
for (int i = 0; http_schemes[i].upper != NULL; i++) {
if (strncmp(http_schemes[i].upper, upper, 7) == 0) {
return (http_schemes[i].lower);
}
}
}
return (NULL);
}

0 comments on commit 3275eda

Please sign in to comment.