Add size check for the comparision logic

pull/35863/head
Andrey Ermolov 1 year ago
parent 239399212a
commit c6649cc9c8
  1. 5
      src/core/ext/transport/chttp2/alpn/alpn.cc

@ -30,7 +30,10 @@ static const char* const supported_versions[] = {"h2"};
int grpc_chttp2_is_alpn_version_supported(const char* version, size_t size) {
size_t i;
for (i = 0; i < GPR_ARRAY_SIZE(supported_versions); i++) {
if (!strncmp(version, supported_versions[i], size)) return 1;
if (size == strlen(supported_versions[i]) &&
!strncmp(version, supported_versions[i], size)) {
return 1;
}
}
return 0;
}

Loading…
Cancel
Save