bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] chdir(".") can raise SIGSEGV


From: Ognyan Kulev
Subject: [PATCH] chdir(".") can raise SIGSEGV
Date: Mon, 25 Mar 2002 16:04:13 +0200
User-agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.9) Gecko/20020311

Hi,

`_hurd_change_directory_port_from_name' in `libc/hurd/hurdchdir.c' tests if the given name ends with `/.'. But with the current code if "." is given and this string starts exactly at page boundary and the previous page is not vm_allocated then SIGSEGV will be raised.

Regards
--
Ognyan Kulev <ogi@fmi.uni-sofia.bg>, "\"Programmer\""
2002-03-25  Ognyan Kulev <ogi@fmi.uni-sofia.bg>

         * hurdchdir.c (_hurd_change_directory_port_from_name): Don't
         test if NAME ends with "/." if strlen(NAME) < 2.
--- hurdchdir.c.orig    Sun Apr  1 08:04:05 2001
+++ hurdchdir.c Mon Mar 25 15:46:53 2002
@@ -36,7 +36,7 @@ _hurd_change_directory_port_from_name (s
   /* Append trailing "/." to directory name to force ENOTDIR if it's not a
      directory and EACCES if we don't have search permission.  */
   len = strlen (name);
-  if (name[len - 2] == '/' && name[len - 1] == '.')
+  if (len >= 2 && name[len - 2] == '/' && name[len - 1] == '.')
     lookup = name;
   else
     {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]