mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
buffer: Simplify handling of the return codes
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -1155,7 +1155,6 @@ int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
|
|||||||
*o.bignum = NULL;
|
*o.bignum = NULL;
|
||||||
tmp_string = ssh_buffer_get_ssh_string(buffer);
|
tmp_string = ssh_buffer_get_ssh_string(buffer);
|
||||||
if (tmp_string == NULL) {
|
if (tmp_string == NULL) {
|
||||||
rc = SSH_ERROR;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*o.bignum = ssh_make_string_bn(tmp_string);
|
*o.bignum = ssh_make_string_bn(tmp_string);
|
||||||
@@ -1174,14 +1173,12 @@ int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
|
|||||||
|
|
||||||
o.cstring = va_arg(ap, char **);
|
o.cstring = va_arg(ap, char **);
|
||||||
*o.cstring = NULL;
|
*o.cstring = NULL;
|
||||||
rc = ssh_buffer_get_u32(buffer, &u32len);
|
rlen = ssh_buffer_get_u32(buffer, &u32len);
|
||||||
if (rc != 4){
|
if (rlen != 4){
|
||||||
rc = SSH_ERROR;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len = ntohl(u32len);
|
len = ntohl(u32len);
|
||||||
if (len > max_len - 1) {
|
if (len > max_len - 1) {
|
||||||
rc = SSH_ERROR;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1237,7 +1234,6 @@ int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SSH_LOG(SSH_LOG_WARN, "Invalid buffer format %c", *p);
|
SSH_LOG(SSH_LOG_WARN, "Invalid buffer format %c", *p);
|
||||||
rc = SSH_ERROR;
|
|
||||||
}
|
}
|
||||||
if (rc != SSH_OK) {
|
if (rc != SSH_OK) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user