]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-07-06 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Tue, 7 Jul 2009 03:05:01 +0000 (03:05 +0000)
committerproski <proski@localhost>
Tue, 7 Jul 2009 03:05:01 +0000 (03:05 +0000)
* commands/search.c (search_fs): Fix potential NULL pointer
dereference.

ChangeLog
commands/search.c

index fd741626a589b161cd707ee5590235e050101d45..ed6b637805a810ad93b92c7b26a20125bf8af427 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-07-06  Pavel Roskin  <proski@gnu.org>
 
+       * commands/search.c (search_fs): Fix potential NULL pointer
+       dereference.
+
        * commands/search.c (search_fs): Replace QUID macro with quid_fn
        function pointer.
 
index b29eefb41abe34e09524673841e9e57f5dd229cf..68ec8ccd6622f544b15679f16293dc02e767018d 100644 (file)
@@ -68,17 +68,19 @@ search_fs (const char *key, const char *var, int no_floppy, int is_uuid)
        {
          grub_fs_t fs;
          int (*compare_fn) (const char *, const char *);
-         grub_err_t (*quid_fn) (grub_device_t, char **);
 
          fs = grub_fs_probe (dev);
          compare_fn = is_uuid ? grub_strcasecmp : grub_strcmp;
-         quid_fn = is_uuid ? fs->uuid : fs->label;
 
-         if (fs && quid_fn)
+         if (fs && (is_uuid ? fs->uuid : fs->label))
            {
              char *quid;
 
-             quid_fn (dev, &quid);
+             if (is_uuid)
+               fs->uuid (dev, &quid);
+             else
+               fs->label (dev, &quid);
+
              if (grub_errno == GRUB_ERR_NONE && quid)
                {
                  if (compare_fn (quid, key) == 0)