diff options
author | Thomas Jarosch <tomj@simonv.com> | 2013-01-15 22:04:18 +0100 |
---|---|---|
committer | Thomas Jarosch <tomj@simonv.com> | 2013-01-15 22:04:18 +0100 |
commit | 5db5341debbfb1230dd7cbff970079790b5e6281 (patch) | |
tree | 3d0a717ce81b4c958b4e68096079aba687974761 /apps/tagcache.c | |
parent | 224c6d68f1e7ec889dc6c26e3eec45a65d643421 (diff) | |
download | rockbox-5db5341debbfb1230dd7cbff970079790b5e6281.tar.gz rockbox-5db5341debbfb1230dd7cbff970079790b5e6281.zip |
Fix possible readlink() buffer overflow
readlink() might return the full size of the target buffer
and we write a '\0' to the returned length offset.
cppecheck reported:
[rockbox/apps/tagcache.c:4335]: (warning, inconclusive) readlink() might return the full size of 'target'. Lower the supplied size by one.
(the check was actually written by me)
Change-Id: Ibb42f732aa42c38bb6cb92cdccd3e6a0d3aa9b9f
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r-- | apps/tagcache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 7034cacab4..07d8d1d7a2 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -4332,7 +4332,7 @@ static bool add_search_root(const char *name) | |||
4332 | static char abs_target[PATH_MAX]; | 4332 | static char abs_target[PATH_MAX]; |
4333 | ssize_t len; | 4333 | ssize_t len; |
4334 | 4334 | ||
4335 | len = readlink(name, target, sizeof(target)); | 4335 | len = readlink(name, target, sizeof(target)-1); |
4336 | if (len < 0) | 4336 | if (len < 0) |
4337 | return false; | 4337 | return false; |
4338 | 4338 | ||