- djm@cvs.openbsd.org 2004/08/23 11:48:09

[authfile.c]
     fix error path, spotted by Martin.Kraemer AT Fujitsu-Siemens.com; ok markus
This commit is contained in:
Darren Tucker 2004-08-29 16:28:39 +10:00
parent f00e51d1f2
commit f4b43712c1
2 changed files with 11 additions and 4 deletions

View File

@ -2,6 +2,10 @@
- (dtucker) [openbsd-compat/getrrsetbyname.c] Prevent getrrsetbyname from - (dtucker) [openbsd-compat/getrrsetbyname.c] Prevent getrrsetbyname from
failing with NOMEMORY if no sigs are returned and malloc(0) returns NULL. failing with NOMEMORY if no sigs are returned and malloc(0) returns NULL.
From Martin.Kraemer at Fujitsu-Siemens.com; ok djm@ From Martin.Kraemer at Fujitsu-Siemens.com; ok djm@
- (dtucker) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2004/08/23 11:48:09
[authfile.c]
fix error path, spotted by Martin.Kraemer AT Fujitsu-Siemens.com; ok markus
20040828 20040828
- (dtucker) [openbsd-compat/mktemp.c] Remove superfluous Cygwin #ifdef; from - (dtucker) [openbsd-compat/mktemp.c] Remove superfluous Cygwin #ifdef; from
@ -1669,4 +1673,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3522 2004/08/29 06:12:29 dtucker Exp $ $Id: ChangeLog,v 1.3523 2004/08/29 06:28:39 dtucker Exp $

View File

@ -36,7 +36,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: authfile.c,v 1.57 2004/06/21 17:36:31 avsm Exp $"); RCSID("$OpenBSD: authfile.c,v 1.58 2004/08/23 11:48:09 djm Exp $");
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/evp.h> #include <openssl/evp.h>
@ -243,8 +243,10 @@ key_load_public_rsa1(int fd, const char *filename, char **commentp)
filename, strerror(errno)); filename, strerror(errno));
return NULL; return NULL;
} }
if (st.st_size > 1*1024*1024) if (st.st_size > 1*1024*1024) {
close(fd); error("key file %.200s too large", filename);
return NULL;
}
len = (size_t)st.st_size; /* truncated */ len = (size_t)st.st_size; /* truncated */
buffer_init(&buffer); buffer_init(&buffer);
@ -335,6 +337,7 @@ key_load_private_rsa1(int fd, const char *filename, const char *passphrase,
return NULL; return NULL;
} }
if (st.st_size > 1*1024*1024) { if (st.st_size > 1*1024*1024) {
error("key file %.200s too large", filename);
close(fd); close(fd);
return (NULL); return (NULL);
} }