Skip to content

Commit e335d43

Browse files
Set out len before returning on err
1 parent e0deaff commit e335d43

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ssl/ssl_lib.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,12 +1044,12 @@ int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *read_bytes) {
10441044
return 1;
10451045
}
10461046
int ret = SSL_read(ssl, buf, (int)num);
1047-
if (ret <= 0) {
1048-
return 0;
1049-
}
10501047
if (read_bytes != nullptr) {
10511048
*read_bytes = ret;
10521049
}
1050+
if (ret <= 0) {
1051+
return 0;
1052+
}
10531053
return 1;
10541054
}
10551055

@@ -1143,12 +1143,12 @@ int SSL_write_ex(SSL *ssl, const void *buf, size_t num, size_t *written) {
11431143
return 1;
11441144
}
11451145
int ret = SSL_write(ssl, buf, (int)num);
1146-
if (ret <= 0) {
1147-
return 0;
1148-
}
11491146
if (written != nullptr) {
11501147
*written = ret;
11511148
}
1149+
if (ret <= 0) {
1150+
return 0;
1151+
}
11521152
return 1;
11531153
}
11541154

0 commit comments

Comments
 (0)