shell32: fix compilation error with strcpy_chk: buffer overflow detected

Nikolay Sivov bunglehead at gmail.com
Sat Jun 2 15:15:45 CDT 2012


A static string constant would be better here.

On Sat, Jun 2, 2012 at 12:42 PM, Vitaly Lipatov <lav at etersoft.ru> wrote:
> ---
>  dlls/shell32/pidl.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
> index c394e5b..5906a4f 100644
> --- a/dlls/shell32/pidl.c
> +++ b/dlls/shell32/pidl.c
> @@ -1752,16 +1752,17 @@ LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
>  LPITEMIDLIST _ILCreateEntireNetwork(void)
>  {
>     LPITEMIDLIST pidlOut;
> +    DWORD alen = sizeof("Entire Network");
>
>     TRACE("\n");
>
> -    pidlOut = _ILAlloc(PT_NETWORK, FIELD_OFFSET(PIDLDATA,
> u.network.szNames[sizeof("Entire Network")]));
> +    pidlOut = _ILAlloc(PT_NETWORK, FIELD_OFFSET(PIDLDATA,
> u.network.szNames[alen]));
>     if (pidlOut)
>     {
>         LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
>
>         pData->u.network.dummy = 0;
> -        strcpy(pData->u.network.szNames, "Entire Network");
> +        memcpy(pData->u.network.szNames, "Entire Network", alen + 1);
>     }
>     return pidlOut;
>  }
> --
> 1.7.9.7
>
> --
> С уважением,
> Виталий Липатов,
> Etersoft
>
>



More information about the wine-devel mailing list