diff options
author | Damien Miller <djm@mindrot.org> | 2006-03-26 14:19:21 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2006-03-26 14:19:21 +1100 |
commit | 07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938 (patch) | |
tree | 098295eee2d7ec7b116b0db3ac4b580713dd5ab0 /uuencode.c | |
parent | 7cd4579eb3c5afd22ae24436fd2611cd3aa0150a (diff) |
- djm@cvs.openbsd.org 2006/03/25 00:05:41
[auth-bsdauth.c auth-skey.c auth.c auth2-chall.c channels.c]
[clientloop.c deattack.c gss-genr.c kex.c key.c misc.c moduli.c]
[monitor.c monitor_wrap.c packet.c scard.c sftp-server.c ssh-agent.c]
[ssh-keyscan.c ssh.c sshconnect.c sshconnect2.c sshd.c uuencode.c]
[xmalloc.c xmalloc.h]
introduce xcalloc() and xasprintf() failure-checked allocations
functions and use them throughout openssh
xcalloc is particularly important because malloc(nmemb * size) is a
dangerous idiom (subject to integer overflow) and it is time for it
to die
feedback and ok deraadt@
Diffstat (limited to 'uuencode.c')
-rw-r--r-- | uuencode.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/uuencode.c b/uuencode.c index 314eb92f3..feda6a016 100644 --- a/uuencode.c +++ b/uuencode.c | |||
@@ -57,9 +57,14 @@ uudecode(const char *src, u_char *target, size_t targsize) | |||
57 | void | 57 | void |
58 | dump_base64(FILE *fp, u_char *data, u_int len) | 58 | dump_base64(FILE *fp, u_char *data, u_int len) |
59 | { | 59 | { |
60 | char *buf = xmalloc(2*len); | 60 | char *buf;; |
61 | int i, n; | 61 | int i, n; |
62 | 62 | ||
63 | if (len > 65536) { | ||
64 | fprintf(fp, "dump_base64: len > 65536\n"); | ||
65 | return; | ||
66 | } | ||
67 | buf = xmalloc(2*len); | ||
63 | n = uuencode(data, len, buf, 2*len); | 68 | n = uuencode(data, len, buf, 2*len); |
64 | for (i = 0; i < n; i++) { | 69 | for (i = 0; i < n; i++) { |
65 | fprintf(fp, "%c", buf[i]); | 70 | fprintf(fp, "%c", buf[i]); |