[PATCH] winspool.drv: Stop crash when PortName is NULL

Huw Davies huw at codeweavers.com
Thu Nov 22 02:55:01 CST 2018


On Thu, Nov 22, 2018 at 03:10:27AM +0000, Alistair Leslie-Hughes wrote:
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33502
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
> ---
>  dlls/winspool.drv/info.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
> index 7c4ee9a..ea4afec 100644
> --- a/dlls/winspool.drv/info.c
> +++ b/dlls/winspool.drv/info.c
> @@ -1572,7 +1572,8 @@ static void old_printer_check( BOOL delete_phase )
>      EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 5, (LPBYTE)pi, needed, &needed, &num );
>      for (i = 0; i < num; i++)
>      {
> -        if (strncmpW( pi[i].pPortName, CUPS_Port, strlenW(CUPS_Port) ) &&
> +        if (pi[i].pPortName &&
> +            strncmpW( pi[i].pPortName, CUPS_Port, strlenW(CUPS_Port) ) &&
>              strncmpW( pi[i].pPortName, LPR_Port, strlenW(LPR_Port) ))
>              continue;
>  

Actually we should continue if pPortName is NULL.  I've sent in a better version.

Thanks,
Huw.



More information about the wine-devel mailing list