patch to fix locale behavior

Alexandre Julliard julliard at winehq.com
Thu May 23 16:32:56 CDT 2002


Mehmet YASAR <myasar at free.fr> writes:

> diff -ur /home/mehmet/CVS/wine/ole/ole2nls.c ./ole2nls.c
> --- /home/mehmet/CVS/wine/ole/ole2nls.c	Sun Apr 28 15:42:21 2002
> +++ ./ole2nls.c	Thu May 23 18:54:38 2002
> @@ -574,8 +574,9 @@
>      }
>      /* if len=0 return only the length, don't touch the buffer*/
>      if (len) {
> -	lstrcpynA(buf,retString,len);
> -	return strlen(buf) + 1;
> +	/* Like Windows we copy len bytes to buffer and we check len after */
> +	strncpy(buf,retString,len);
> +	return (len < strlen(retString) + 1)? 0 : strlen(retString)+1 ;

Note that strncpy will fill the buffer with nulls if the string is too
short. I doubt that Windows does that, though it may be a good idea to
check for it in your test too.

-- 
Alexandre Julliard
julliard at winehq.com



More information about the wine-devel mailing list