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 /ssh.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 'ssh.c')
-rw-r--r-- | ssh.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -687,7 +687,7 @@ main(int ac, char **av) | |||
687 | if (options.rhosts_rsa_authentication || | 687 | if (options.rhosts_rsa_authentication || |
688 | options.hostbased_authentication) { | 688 | options.hostbased_authentication) { |
689 | sensitive_data.nkeys = 3; | 689 | sensitive_data.nkeys = 3; |
690 | sensitive_data.keys = xmalloc(sensitive_data.nkeys * | 690 | sensitive_data.keys = xcalloc(sensitive_data.nkeys, |
691 | sizeof(Key)); | 691 | sizeof(Key)); |
692 | 692 | ||
693 | PRIV_START; | 693 | PRIV_START; |
@@ -1250,7 +1250,8 @@ env_permitted(char *env) | |||
1250 | int i; | 1250 | int i; |
1251 | char name[1024], *cp; | 1251 | char name[1024], *cp; |
1252 | 1252 | ||
1253 | strlcpy(name, env, sizeof(name)); | 1253 | if (strlcpy(name, env, sizeof(name)) >= sizeof(name)) |
1254 | fatal("env_permitted: name too long"); | ||
1254 | if ((cp = strchr(name, '=')) == NULL) | 1255 | if ((cp = strchr(name, '=')) == NULL) |
1255 | return (0); | 1256 | return (0); |
1256 | 1257 | ||