diff options
| author | 2025-06-10 21:25:43 +0200 | |
|---|---|---|
| committer | 2025-06-10 21:25:43 +0200 | |
| commit | 9d26a1636ba684b600b5cfa0e96e7cb648501539 (patch) | |
| tree | 9c42deaaa965c99efa3ff03aa1ec0b3198ee7f73 | |
| parent | 796d09d32de51e933bb300d9847c46e3a96eb9ac (diff) | |
| download | libimobiledevice-9d26a1636ba684b600b5cfa0e96e7cb648501539.tar.gz libimobiledevice-9d26a1636ba684b600b5cfa0e96e7cb648501539.tar.bz2 | |
idevice: Remove unused assignment in SSL bio callback for OpenSSL < 3.0
At the same time, make sure we don't set a negative value to *processed
for OpenSSL >= 3.0
| -rw-r--r-- | src/idevice.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/idevice.c b/src/idevice.c index 2252d22..0af27fd 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -1079,13 +1079,14 @@ static long ssl_idevice_bio_callback(BIO *b, int oper, const char *argp, int arg | |||
| 1079 | idevice_connection_t conn = (idevice_connection_t)BIO_get_callback_arg(b); | 1079 | idevice_connection_t conn = (idevice_connection_t)BIO_get_callback_arg(b); |
| 1080 | #if OPENSSL_VERSION_NUMBER < 0x30000000L | 1080 | #if OPENSSL_VERSION_NUMBER < 0x30000000L |
| 1081 | size_t len = (size_t)argi; | 1081 | size_t len = (size_t)argi; |
| 1082 | size_t *processed = (size_t*)&bytes; | ||
| 1083 | #endif | 1082 | #endif |
| 1084 | switch (oper) { | 1083 | switch (oper) { |
| 1085 | case (BIO_CB_READ|BIO_CB_RETURN): | 1084 | case (BIO_CB_READ|BIO_CB_RETURN): |
| 1086 | if (argp) { | 1085 | if (argp) { |
| 1087 | bytes = internal_ssl_read(conn, (char *)argp, len); | 1086 | bytes = internal_ssl_read(conn, (char *)argp, len); |
| 1088 | *processed = bytes; | 1087 | #if OPENSSL_VERSION_NUMBER >= 0x30000000L |
| 1088 | *processed = (size_t)(bytes < 0) ? 0 : bytes; | ||
| 1089 | #endif | ||
| 1089 | return (long)bytes; | 1090 | return (long)bytes; |
| 1090 | } | 1091 | } |
| 1091 | return 0; | 1092 | return 0; |
| @@ -1094,7 +1095,9 @@ static long ssl_idevice_bio_callback(BIO *b, int oper, const char *argp, int arg | |||
| 1094 | // fallthrough | 1095 | // fallthrough |
| 1095 | case (BIO_CB_WRITE|BIO_CB_RETURN): | 1096 | case (BIO_CB_WRITE|BIO_CB_RETURN): |
| 1096 | bytes = internal_ssl_write(conn, argp, len); | 1097 | bytes = internal_ssl_write(conn, argp, len); |
| 1097 | *processed = bytes; | 1098 | #if OPENSSL_VERSION_NUMBER >= 0x30000000L |
| 1099 | *processed = (size_t)(bytes < 0) ? 0 : bytes; | ||
| 1100 | #endif | ||
| 1098 | return (long)bytes; | 1101 | return (long)bytes; |
| 1099 | default: | 1102 | default: |
| 1100 | return retvalue; | 1103 | return retvalue; |
