diff options
author | tpashkin <tpashkin@yandex-team.ru> | 2022-02-10 16:46:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:41 +0300 |
commit | 5475379a04e37df30085bd1724f1c57e3f40996f (patch) | |
tree | 95d77e29785a3bd5be6260b1c9d226a551376ecf /contrib/libs/openssl/apps/apps.c | |
parent | c3d34b9b40eb534dfd2c549342274f3d61844688 (diff) | |
download | ydb-5475379a04e37df30085bd1724f1c57e3f40996f.tar.gz |
Restoring authorship annotation for <tpashkin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/openssl/apps/apps.c')
-rw-r--r-- | contrib/libs/openssl/apps/apps.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/contrib/libs/openssl/apps/apps.c b/contrib/libs/openssl/apps/apps.c index c06241abb97..18e42a57343 100644 --- a/contrib/libs/openssl/apps/apps.c +++ b/contrib/libs/openssl/apps/apps.c @@ -1962,46 +1962,46 @@ unsigned char *next_protos_parse(size_t *outlen, const char *in) size_t len; unsigned char *out; size_t i, start = 0; - size_t skipped = 0; + size_t skipped = 0; len = strlen(in); - if (len == 0 || len >= 65535) + if (len == 0 || len >= 65535) return NULL; - out = app_malloc(len + 1, "NPN buffer"); + out = app_malloc(len + 1, "NPN buffer"); for (i = 0; i <= len; ++i) { if (i == len || in[i] == ',') { - /* - * Zero-length ALPN elements are invalid on the wire, we could be - * strict and reject the entire string, but just ignoring extra - * commas seems harmless and more friendly. - * - * Every comma we skip in this way puts the input buffer another - * byte ahead of the output buffer, so all stores into the output - * buffer need to be decremented by the number commas skipped. - */ - if (i == start) { - ++start; - ++skipped; - continue; - } + /* + * Zero-length ALPN elements are invalid on the wire, we could be + * strict and reject the entire string, but just ignoring extra + * commas seems harmless and more friendly. + * + * Every comma we skip in this way puts the input buffer another + * byte ahead of the output buffer, so all stores into the output + * buffer need to be decremented by the number commas skipped. + */ + if (i == start) { + ++start; + ++skipped; + continue; + } if (i - start > 255) { OPENSSL_free(out); return NULL; } - out[start-skipped] = (unsigned char)(i - start); + out[start-skipped] = (unsigned char)(i - start); start = i + 1; } else { - out[i + 1 - skipped] = in[i]; + out[i + 1 - skipped] = in[i]; } } - if (len <= skipped) { - OPENSSL_free(out); - return NULL; - } - - *outlen = len + 1 - skipped; + if (len <= skipped) { + OPENSSL_free(out); + return NULL; + } + + *outlen = len + 1 - skipped; return out; } |