summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2010-04-15 16:23:39 -0400
committerDoug Ledford <dledford@redhat.com>2010-04-15 16:23:39 -0400
commit5fe4560ba6f9b1fd7e2f4ec992410e9389f5ec7b (patch)
tree88dad8a59731ad059da9aa71be3fed36160dae09
parente53cca512da24c8d92ed469ea92f4ecd8869547c (diff)
downloadmdadm-5fe4560ba6f9b1fd7e2f4ec992410e9389f5ec7b.tar.gz
mdadm-5fe4560ba6f9b1fd7e2f4ec992410e9389f5ec7b.tar.xz
mdadm-5fe4560ba6f9b1fd7e2f4ec992410e9389f5ec7b.zip
Null terminate our return value so string functions work
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--util.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util.c b/util.c
index 9327b75..cd17d93 100644
--- a/util.c
+++ b/util.c
@@ -1678,6 +1678,8 @@ char *get_devpath_from_devname(char *devname)
read = readlink(symlink, target, sizeof(target));
if (read < 0)
continue;
+ /* Have to null terminate the return */
+ target[read] = 0;
link = strrchr(target, '/');
if (!link++)
link = target;