summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2014-02-18 23:19:07 -0800
committerMichael Pavone <pavone@retrodev.com>2014-02-18 23:19:07 -0800
commit33910344b7546f27baba85921c0c7bdd70b1b0a9 (patch)
tree12bdfd8bb1b78a28a8e5517b5b1056dbee9da2aa
parentc2366d61ff6e228cb3242993d457ff115cd98c91 (diff)
Properly null terminate string returned by readlink in util.c
-rw-r--r--util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util.c b/util.c
index 0b8d8cb..2bc3109 100644
--- a/util.c
+++ b/util.c
@@ -94,7 +94,8 @@ char * readlink_alloc(char * path)
free(linktext);
linktext = NULL;
}
- } while (linksize > cursize);
+ } while ((linksize+1) > cursize);
+ linktext[linksize] = 0;
return linktext;
}