[rtems commit] libblock: Avoid NULL pointer access

Sebastian Huber sebh at rtems.org
Mon Nov 2 07:23:25 UTC 2015


Module:    rtems
Branch:    4.11
Commit:    12b5264318591a861e669e14ccb7f1bc5bb6249a
Changeset: http://git.rtems.org/rtems/commit/?id=12b5264318591a861e669e14ccb7f1bc5bb6249a

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 8953b79..ec29eea 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