Branch: Tag:

2009-10-25

2009-10-25 12:03:25 by Martin Stjernholm <mast@lysator.liu.se>

Avoid segfault in combine_path_nt on windows when the first char of an
appended path is wide.

Rev: src/combine_path.h:1.15

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: combine_path.h,v 1.14 2004/01/12 22:56:48 marcus Exp $ + || $Id: combine_path.h,v 1.15 2009/10/25 12:03:25 mast Exp $   */      /*
39:   {    int c0=INDEX_PCHARP(s,0);    int c1=c0?INDEX_PCHARP(s,1):0; -  if(isalpha(c0) && c1==':' && IS_SEP(INDEX_PCHARP(s,2))) +  /* The following used to use isalpha(c0), but it apparently can +  * index out-of-bound memory in the msvc 9.0 crt when given 16-bit +  * char values (known to occur with 0x20ac, at least). Besides, a +  * drive letter is limited to a..z, so this is faster and more +  * correct. */ +  if(((c0 >= 'A' && c0 <= 'Z') || +  (c0 >= 'a' && c0 <= 'z')) && +  c1==':' && IS_SEP(INDEX_PCHARP(s,2)))    return 3;       if(IS_SEP(c0) && IS_SEP(c1))