Make it an error to call dbiGetToSet() with NULL keyp
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 9 Jun 2011 08:07:21 +0000 (11:07 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 9 Jun 2011 08:07:21 +0000 (11:07 +0300)
- All current callers always supply non-NULL keyp, and requiring
  this gives useful possibilities elsewhere

lib/rpmdb.c

index 19e999c..b041768 100644 (file)
@@ -475,10 +475,10 @@ static int dbiGetToSet(dbiIndex dbi, const char *keyp, size_t keylen,
                       dbiIndexSet *set)
 {
     int rc = EINVAL;
-    if (dbi != NULL) {
+    if (dbi != NULL && keyp != NULL) {
        dbiCursor dbc = dbiCursorInit(dbi, 0);
 
-       if (keyp && keylen == 0) {
+       if (keylen == 0) {
            keylen = strlen(keyp);
            if (keylen == 0)
                keylen++; /* XXX "/" fixup */