[rtems commit] libblock: Avoid NULL pointer access

Sebastian Huber sebh at rtems.org
Mon Nov 2 07:22:24 UTC 2015


Module:    rtems
Branch:    master
Commit:    09d4f629b201d225f3e117be4c6449c67c7f08b3
Changeset: http://git.rtems.org/rtems/commit/?id=09d4f629b201d225f3e117be4c6449c67c7f08b3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Oct 30 13:00:01 2015 +0100

libblock: Avoid NULL pointer access

---

 cpukit/libblock/src/media.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpukit/libblock/src/media.c b/cpukit/libblock/src/media.c
index d1679c8..3cdb3e9 100644
--- a/cpukit/libblock/src/media.c
+++ b/cpukit/libblock/src/media.c
@@ -203,7 +203,9 @@ static media_item *get_media_item(
 
     if (
       (disk_path == NULL || strcmp(disk_path, item->disk_path) == 0)
-        && (mount_path == NULL || strcmp(mount_path, item->mount_path) == 0)
+        && (mount_path == NULL
+          || (item->mount_path != NULL
+            && strcmp(mount_path, item->mount_path) == 0))
     ) {
       return item;
     }



More information about the vc mailing list