This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Cygwin: TEST only: Add a buffer underrun assertion to symlink_info::check


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7d00a5e320db60b462be5b330fc1358f706add76

commit 7d00a5e320db60b462be5b330fc1358f706add76
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue May 29 18:04:14 2018 +0200

    Cygwin: TEST only: Add a buffer underrun assertion to symlink_info::check
    
    Thanks to Ken Harris <Ken.Harris@mathworks.com> for the diagnosis
    which led to a buffer underrun in this loop.
    
    Revert before release.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/path.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index a132a0a..94f4e88 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -57,6 +57,7 @@
 #include <sys/param.h>
 #include <sys/cygwin.h>
 #include <wctype.h>
+#include <assert.h>
 #include "cygerrno.h"
 #include "path.h"
 #include "fhandler.h"
@@ -2800,7 +2801,7 @@ restart:
 	      if (*p != '.' && *p != ' ')
 		{
 		  while (*--p != '\\')
-		    ;
+		    assert(p >= path);
 		  if (*++p != ' ')
 		    p = NULL;
 		}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]