Skip to content

Instantly share code, notes, and snippets.

@xiw
Created September 27, 2012 18:35
Show Gist options
  • Save xiw/3795610 to your computer and use it in GitHub Desktop.
Save xiw/3795610 to your computer and use it in GitHub Desktop.
Avoid null pointer dereference in __dbc_cmp_pp()
diff --git a/src/db/db_iface.c b/src/db/db_iface.c
index 59e0ba5..88ee548 100644
--- a/src/db/db_iface.c
+++ b/src/db/db_iface.c
@@ -2127,13 +2127,12 @@ __dbc_cmp_pp(dbc, other_cursor, result, flags)
int *result;
u_int32_t flags;
{
- DB *dbp, *odbp;
+ DB *dbp;
DB_THREAD_INFO *ip;
ENV *env;
int ret;
dbp = dbc->dbp;
- odbp = other_cursor->dbp;
env = dbp->env;
if (flags != 0)
@@ -2145,7 +2144,7 @@ __dbc_cmp_pp(dbc, other_cursor, result, flags)
return (EINVAL);
}
- if (dbp != odbp) {
+ if (dbp != other_cursor->dbp) {
__db_errx(env, DB_STR("0618",
"DBcursor->cmp both cursors must refer to the same database."));
return (EINVAL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment