Skip to contentSkip to conversation

vvfat: Fix potential buffer overflow

PATCH New Kevin Wolf 1 participant 1 message Oct 10, 2011 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 vvfat: Fix potential buffer overflow

path2[PATH_MAX] can be used for the null termination, so make the array big enough to allow this.

---
 block/vvfat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block/vvfat.c +1 -1
index ba207e2..7e9e35a 100644
@@ -1690,7 +1690,7 @@ static int check_directory_consistency(BDRVVVFATState *s,
 
     long_file_name lfn;
     int path_len = strlen(path);
-    char path2[PATH_MAX];
+    char path2[PATH_MAX + 1];
 
     assert(path_len < PATH_MAX); /* len was tested before! */
     pstrcpy(path2, sizeof(path2), path);
Signature · 1 line
1.7.6.4