Make static analysis happy about the length of patternBuf
authorChristopher Dykes <cdykes@fb.com>
Mon, 18 Jul 2016 16:56:55 +0000 (09:56 -0700)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Mon, 18 Jul 2016 17:08:29 +0000 (10:08 -0700)
Summary: The static analysis doesn't quite understand that we are assigning a NUL to, at most, `patternBuf[MAX_PATH + 1]` so increase the buffer size slightly to make it happy.

Reviewed By: yfeldblum

Differential Revision: D3571923

fbshipit-source-id: c027e2b253dc3e56d13e9a15a0e960a6aa3a0e6c

folly/portability/Dirent.cpp

index 5c75a2003a4a13509593e94d4de546a976d57ff8..5c01eb829955435063c42cadd84ae75d5408e851 100755 (executable)
@@ -34,7 +34,7 @@ struct DIR {
   }
 
   DIR* open() {
-    wchar_t patternBuf[MAX_PATH + 2];
+    wchar_t patternBuf[MAX_PATH + 3];
     size_t len;
 
     if (mbstowcs_s(&len, patternBuf, MAX_PATH, pattern.c_str(), MAX_PATH - 2)) {