Fix tls13_server tls13_send bug

This commit is contained in:
Zhi Guan
2022-07-30 11:46:56 +08:00
parent b7f8c5113d
commit 605026da08
2 changed files with 6 additions and 6 deletions

View File

@@ -1507,7 +1507,7 @@ int tls_record_send(const uint8_t *record, size_t recordlen, int sock)
return -1;
}
if ((r = send(sock, record, recordlen, 0)) < 0) {
perror("");
perror("tls_record_send");
error_print();
return -1;
} else if (r != recordlen) {
@@ -1526,12 +1526,12 @@ int tls_record_do_recv(uint8_t *record, size_t *recordlen, int sock)
len = 5;
while (len) {
if ((r = recv(sock, record + 5 - len, len, 0)) < 0) {
perror("");
perror("tls_record_do_recv");
error_print();
return -1;
}
if (r == 0) {
perror("");
perror("tls_record_do_recv");
error_print();
return 0;
}
@@ -1555,7 +1555,7 @@ int tls_record_do_recv(uint8_t *record, size_t *recordlen, int sock)
}
while (len) {
if ((r = recv(sock, record + *recordlen - len, len, 0)) < 0) {
perror("");
perror("tls_record_do_recv");
error_print();
return -1;
}
@@ -2310,7 +2310,7 @@ int tls_set_socket(TLS_CONNECT *conn, int sock)
if ((opts = fcntl(sock, F_GETFL)) < 0) {
error_print();
perror("");
perror("tls_set_socket");
return -1;
}
opts &= ~O_NONBLOCK;

View File

@@ -209,7 +209,7 @@ restart:
}
} while (!len);
if (tls13_send(&conn, (uint8_t *)buf, len, /* &sentlen*/ 0) != 1) {
if (tls13_send(&conn, (uint8_t *)buf, len, &sentlen) != 1) {
fprintf(stderr, "%s: send failure, close connection\n", prog);
close(conn.sock);
goto end;