Fixed one byte buffer overrun

This occurs when reading symlinks that are bigger than the buffer provided.
This commit is contained in:
gerow 2015-06-20 11:05:18 -04:00
parent 5aa6067f8c
commit 753275f161

View File

@ -1339,7 +1339,9 @@ static int readlink_ext2(fs_node_t * node, char * buf, size_t size) {
}
/* Believe it or not, we actually aren't supposed to include the nul in the length. */
buf[read_size] = '\0';
if (read_size < size) {
buf[read_size] = '\0';
}
free(inode);
return read_size;