[redland-dev] Memory overrun in raptor_uri_filename_to_uri_string() / WIN32

Steve Harris steve.harris at garlik.com
Tue Aug 19 14:46:30 BST 2008


On 19 Aug 2008, at 14:41, Aymeric Barthe wrote:
>
> #ifdef WIN32
>  if(filename[1] == ':' && filename[2] != '\\') // Memory overrun here!
>    len+=3; /* relative filename - add / and ./ */
>  else if(*filename == '\\')
>    len-=2; /* two // from not needed in filename */
>  else
>    len++; /* / at start of path */
> #else
>
> I guess a calling an strlen() would do the trick, but I am not sure it
> would be so efficient:
>  if( (strlen(filename) >= 3) && filename[1] == ':' && filename[2] !=
> '\\')

it could be

   if (filename[0] && filename[1] == ':' && filename[2] != '\\')

- Steve


More information about the redland-dev mailing list