add length check

pull/23038/head
yihuaz 5 years ago
parent ff045fde0d
commit 6591d0997b
  1. 6
      test/core/tsi/ssl_transport_security_test.cc

@ -251,7 +251,8 @@ static bool check_subject_alt_name(tsi_peer* peer, const char* name) {
const tsi_peer_property* prop = &peer->properties[i];
if (strcmp(prop->name, TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY) ==
0) {
if (memcmp(prop->value.data, name, prop->value.length) == 0) {
if (strlen(name) == prop->value.length &&
memcmp(prop->value.data, name, prop->value.length) == 0) {
return true;
}
}
@ -263,7 +264,8 @@ static bool check_uri(tsi_peer* peer, const char* name) {
for (size_t i = 0; i < peer->property_count; i++) {
const tsi_peer_property* prop = &peer->properties[i];
if (strcmp(prop->name, TSI_X509_URI_PEER_PROPERTY) == 0) {
if (memcmp(prop->value.data, name, prop->value.length) == 0) {
if (strlen(name) == prop->value.length &&
memcmp(prop->value.data, name, prop->value.length) == 0) {
return true;
}
}

Loading…
Cancel
Save