diff options
author | Jakub Jelen <jjelen@redhat.com> | 2019-09-24 16:04:02 +0200 |
---|---|---|
committer | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2019-09-30 16:00:30 +0200 |
commit | de4034bfe0e7651649829900755f0141dd96699e (patch) | |
tree | 7928278fa2380511113f4ff902e6156c5e372121 | |
parent | 6ccd84bae9296fc08e837431d4b616d800ce71a6 (diff) | |
download | libssh-de4034bfe0e7651649829900755f0141dd96699e.tar.gz libssh-de4034bfe0e7651649829900755f0141dd96699e.tar.xz libssh-de4034bfe0e7651649829900755f0141dd96699e.zip |
buffer: Simplify handling of the return codes
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit e72429f205bd1a17062ae95f8850b510d71b2964)
-rw-r--r-- | src/buffer.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c index d7d90d07..a2e6246a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1155,7 +1155,6 @@ int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer, *o.bignum = NULL; tmp_string = ssh_buffer_get_ssh_string(buffer); if (tmp_string == NULL) { - rc = SSH_ERROR; break; } *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 = NULL; - rc = ssh_buffer_get_u32(buffer, &u32len); - if (rc != 4){ - rc = SSH_ERROR; + rlen = ssh_buffer_get_u32(buffer, &u32len); + if (rlen != 4){ break; } len = ntohl(u32len); if (len > max_len - 1) { - rc = SSH_ERROR; break; } @@ -1237,7 +1234,6 @@ int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer, break; default: SSH_LOG(SSH_LOG_WARN, "Invalid buffer format %c", *p); - rc = SSH_ERROR; } if (rc != SSH_OK) { break; |