summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2000-02-15 06:13:38 +0000
committerTim Potter <tpot@samba.org>2000-02-15 06:13:38 +0000
commit13ac8fd847f9cc0a7c7d04034dfb8214edccbe48 (patch)
tree20203c9624f3ae79808767a02a4ff99b0c2d2421 /source3
parent74ca35e4eef8e758f37488a1128d462c21ce004c (diff)
downloadsamba-13ac8fd847f9cc0a7c7d04034dfb8214edccbe48.tar.gz
samba-13ac8fd847f9cc0a7c7d04034dfb8214edccbe48.tar.bz2
samba-13ac8fd847f9cc0a7c7d04034dfb8214edccbe48.zip
Return "Invalid tdb context" instead of crashing when tdb_error called
with NULL tdb context. (This used to be commit ba9f24c0964054f22cd8f0de32cfeacb88b4800c)
Diffstat (limited to 'source3')
-rw-r--r--source3/tdb/tdb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index c469436f75..a754c583e6 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -575,9 +575,13 @@ char *tdb_error(TDB_CONTEXT *tdb)
{TDB_ERR_OOM, "Out of memory"},
{TDB_ERR_EXISTS, "Record exists"},
{-1, NULL}};
- for (i=0;emap[i].estring;i++) {
+ if (tdb != NULL) {
+ for (i=0;emap[i].estring;i++) {
if (tdb->ecode == emap[i].ecode) return emap[i].estring;
- }
+ }
+ } else {
+ return "Invalid tdb context";
+ }
return "Invalid error code";
}