diff options
Diffstat (limited to 'bufaux.c')
-rw-r--r-- | bufaux.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -15,7 +15,7 @@ Buffers. | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: bufaux.c,v 1.4 1999/11/12 23:51:58 damien Exp $"); | 18 | RCSID("$Id: bufaux.c,v 1.5 1999/11/13 02:22:46 damien Exp $"); |
19 | 19 | ||
20 | #include "ssh.h" | 20 | #include "ssh.h" |
21 | 21 | ||
@@ -71,10 +71,11 @@ buffer_get_bignum(Buffer *buffer, BIGNUM *value) | |||
71 | bits = GET_16BIT(buf); | 71 | bits = GET_16BIT(buf); |
72 | /* Compute the number of binary bytes that follow. */ | 72 | /* Compute the number of binary bytes that follow. */ |
73 | bytes = (bits + 7) / 8; | 73 | bytes = (bits + 7) / 8; |
74 | bin = xmalloc(bytes); | 74 | if (buffer_len(buffer) < bytes) |
75 | buffer_get(buffer, bin, bytes); | 75 | fatal("buffer_get_bignum: input buffer too small"); |
76 | bin = buffer_ptr(buffer); | ||
76 | BN_bin2bn(bin, bytes, value); | 77 | BN_bin2bn(bin, bytes, value); |
77 | xfree(bin); | 78 | buffer_consume(buffer, bytes); |
78 | 79 | ||
79 | return 2 + bytes; | 80 | return 2 + bytes; |
80 | } | 81 | } |