summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-10-30 13:00:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-11-02 08:21:49 +0100
commit09d4f629b201d225f3e117be4c6449c67c7f08b3 (patch)
tree5657390226cdf51f601a01de4359f461a3e35204
parentada: Add missing include (diff)
downloadrtems-09d4f629b201d225f3e117be4c6449c67c7f08b3.tar.bz2
libblock: Avoid NULL pointer access
-rw-r--r--cpukit/libblock/src/media.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpukit/libblock/src/media.c b/cpukit/libblock/src/media.c
index d1679c8094..3cdb3e933e 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;
}