summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sendmail/libsmdb/smdb1.c
diff options
context:
space:
mode:
authorJohn Beck <John.Beck@Sun.COM>2010-01-06 13:22:51 -0800
committerJohn Beck <John.Beck@Sun.COM>2010-01-06 13:22:51 -0800
commite9af4bc0b1cc30cea75d6ad4aa2fde97d985e9be (patch)
tree6a7ad97561f2580625546f56c063c89ebb3b92dd /usr/src/cmd/sendmail/libsmdb/smdb1.c
parent5f8171005a0c33f3c67f7da52d41c2362c3fd891 (diff)
downloadillumos-joyent-e9af4bc0b1cc30cea75d6ad4aa2fde97d985e9be.tar.gz
6913961 upgrade sendmail to 8.14.4
6790772 Array overrun in sendmail
Diffstat (limited to 'usr/src/cmd/sendmail/libsmdb/smdb1.c')
-rw-r--r--usr/src/cmd/sendmail/libsmdb/smdb1.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/usr/src/cmd/sendmail/libsmdb/smdb1.c b/usr/src/cmd/sendmail/libsmdb/smdb1.c
index 3b8508f479..842d4b2eca 100644
--- a/usr/src/cmd/sendmail/libsmdb/smdb1.c
+++ b/usr/src/cmd/sendmail/libsmdb/smdb1.c
@@ -1,5 +1,5 @@
/*
-** Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
+** Copyright (c) 1999-2002, 2004, 2009 Sendmail, Inc. and its suppliers.
** All rights reserved.
**
** By using this file, you agree to the terms and conditions set
@@ -7,10 +7,8 @@
** the sendmail distribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: smdb1.c,v 8.59 2004/08/03 20:58:39 ca Exp $")
+SM_RCSID("@(#)$Id: smdb1.c,v 8.62 2009/11/12 23:04:18 ca Exp $")
#include <unistd.h>
#include <stdlib.h>
@@ -399,15 +397,19 @@ smdb1_cursor(database, cursor, flags)
if (db1->smdb1_cursor_in_use)
return SMDBE_ONLY_SUPPORTS_ONE_CURSOR;
- db1->smdb1_cursor_in_use = true;
db1_cursor = (SMDB_DB1_CURSOR *) malloc(sizeof(SMDB_DB1_CURSOR));
- db1_cursor->db = db1;
+ if (db1_cursor == NULL)
+ return SMDBE_MALLOC;
cur = (SMDB_CURSOR *) malloc(sizeof(SMDB_CURSOR));
-
if (cur == NULL)
+ {
+ free(db1_cursor);
return SMDBE_MALLOC;
+ }
+ db1->smdb1_cursor_in_use = true;
+ db1_cursor->db = db1;
cur->smdbc_impl = db1_cursor;
cur->smdbc_close = smdb1_cursor_close;
cur->smdbc_del = smdb1_cursor_del;
@@ -504,7 +506,12 @@ smdb_db_open(database, db_name, mode, mode_mask, sff, type, user_info,
smdb_db = smdb_malloc_database();
db1 = smdb1_malloc_database();
if (smdb_db == NULL || db1 == NULL)
+ {
+ (void) smdb_unlock_file(lock_fd);
+ smdb_free_database(smdb_db);
+ free(db1);
return SMDBE_MALLOC;
+ }
db1->smdb1_lock_fd = lock_fd;
params = NULL;