Skip to content

Commit

Permalink
Merge pull request #502 from dongbeiouba/fix/cerror
Browse files Browse the repository at this point in the history
修复编译告警
  • Loading branch information
wa5i authored Oct 9, 2023
2 parents 1e88e75 + 886334b commit 5409282
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
6 changes: 3 additions & 3 deletions crypto/pem/pem_lib.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -810,7 +810,7 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
{
BIO *tmp = *header;
char *linebuf, *p;
int len, line, ret = 0, end = 0, prev_partial_line_read = 0, partial_line_read = 0;
int len, ret = 0, end = 0, prev_partial_line_read = 0, partial_line_read = 0;
/* 0 if not seen (yet), 1 if reading header, 2 if finished header */
enum header_status got_header = MAYBE_HEADER;
unsigned int flags_mask;
Expand All @@ -824,7 +824,7 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
return 0;
}

for (line = 0; ; line++) {
while(1) {
flags_mask = ~0u;
len = BIO_gets(bp, linebuf, LINESIZE);
if (len <= 0) {
Expand Down
3 changes: 0 additions & 3 deletions crypto/txt_db/txt_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
{
TXT_DB *ret = NULL;
int esc = 0;
long ln = 0;
int i, add, n;
int size = BUFSIZE;
int offset = 0;
Expand Down Expand Up @@ -61,7 +60,6 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
}
buf->data[offset] = '\0';
BIO_gets(in, &(buf->data[offset]), size - offset);
ln++;
if (buf->data[offset] == '\0')
break;
if ((offset == 0) && (buf->data[0] == '#'))
Expand All @@ -80,7 +78,6 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
p += add;
n = 0;
pp[n++] = p;
i = 0;
f = buf->data;

esc = 0;
Expand Down
8 changes: 2 additions & 6 deletions crypto/x509/x_name.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -499,9 +499,7 @@ int X509_NAME_set(X509_NAME **xn, const X509_NAME *name)
int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
{
char *s, *c, *b;
int l, i;

l = 80 - 2 - obase;
int i;

b = X509_NAME_oneline(name, NULL, 0);
if (b == NULL)
Expand All @@ -527,12 +525,10 @@ int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
if (BIO_write(bp, ", ", 2) != 2)
goto err;
}
l--;
}
if (*s == '\0')
break;
s++;
l--;
}

OPENSSL_free(b);
Expand Down
7 changes: 3 additions & 4 deletions ssl/statem_ntls/ntls_statem_clnt.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2022 The Tongsuo Project Authors. All Rights Reserved.
* Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2023 The Tongsuo Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -1241,7 +1241,6 @@ MSG_PROCESS_RETURN tls_process_server_certificate_ntls(SSL *s, PACKET *pkt)
unsigned long cert_list_len, cert_len;
X509 *x = NULL;
const unsigned char *certstart, *certbytes;
size_t chainidx;
unsigned int context = 0;

if ((s->session->peer_chain = sk_X509_new_null()) == NULL) {
Expand All @@ -1256,7 +1255,7 @@ MSG_PROCESS_RETURN tls_process_server_certificate_ntls(SSL *s, PACKET *pkt)
SSLfatal_ntls(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH);
goto err;
}
for (chainidx = 0; PACKET_remaining(pkt); chainidx++) {
while (PACKET_remaining(pkt)) {
if (!PACKET_get_net_3(pkt, &cert_len)
|| !PACKET_get_bytes(pkt, &certbytes, cert_len)) {
SSLfatal_ntls(s, SSL_AD_DECODE_ERROR, SSL_R_CERT_LENGTH_MISMATCH);
Expand Down
7 changes: 3 additions & 4 deletions ssl/statem_ntls/ntls_statem_srvr.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2022 The Tongsuo Project Authors. All Rights Reserved.
* Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2023 The Tongsuo Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -2086,7 +2086,6 @@ MSG_PROCESS_RETURN tls_process_client_certificate_ntls(SSL *s, PACKET *pkt)
const unsigned char *certstart, *certbytes;
STACK_OF(X509) *sk = NULL;
PACKET spkt;
size_t chainidx;
SSL_SESSION *new_sess = NULL;

/*
Expand All @@ -2107,7 +2106,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate_ntls(SSL *s, PACKET *pkt)
goto err;
}

for (chainidx = 0; PACKET_remaining(&spkt) > 0; chainidx++) {
while (PACKET_remaining(&spkt) > 0) {
if (!PACKET_get_net_3(&spkt, &l)
|| !PACKET_get_bytes(&spkt, &certbytes, l)) {
SSLfatal_ntls(s, SSL_AD_DECODE_ERROR, SSL_R_CERT_LENGTH_MISMATCH);
Expand Down
5 changes: 1 addition & 4 deletions test/testutil/driver.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -336,8 +336,6 @@ int run_tests(const char *test_prog_name)
num_failed++;
test_case_count++;
} else {
int num_failed_inner = 0;

verdict = TEST_SKIP_CODE;
set_test_title(all_tests[i].test_case_name);
if (all_tests[i].subtest) {
Expand Down Expand Up @@ -368,7 +366,6 @@ int run_tests(const char *test_prog_name)
v = all_tests[i].param_test_fn(j);

if (v == 0) {
++num_failed_inner;
verdict = 0;
} else if (v != TEST_SKIP_CODE && verdict != 0) {
verdict = 1;
Expand Down

0 comments on commit 5409282

Please sign in to comment.