Only honor keylen if keyp is also specified
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 9 Jun 2011 08:26:32 +0000 (11:26 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 9 Jun 2011 08:26:32 +0000 (11:26 +0300)
lib/rpmdb.c

index b041768..eb72607 100644 (file)
@@ -455,8 +455,10 @@ static int dbiCursorGetToSet(dbiCursor dbc, const char *keyp, size_t keylen,
        memset(&data, 0, sizeof(data));
        memset(&key, 0, sizeof(key));
 
-       key.data = (void *) keyp; /* discards const */
-       key.size = keylen;
+       if (keyp) {
+           key.data = (void *) keyp; /* discards const */
+           key.size = keylen;
+       }
 
        rc = dbiCursorGet(dbc, &key, &data, DB_SET);