wininet: skip strcmp() in a test if the returned len is wrong

Dmitry Timoshkov dmitry at codeweavers.com
Thu Nov 8 20:58:16 CST 2007


"Lei Zhang" <thestig at google.com> wrote:

> We'll skip doing strcmp() on a potentially uninitialized buffer if the
> returned length is wrong.

> -  todo_wine ok(!strcmp(useragent,buffer),"Got wrong user agent string %s instead of %s\n",buffer,useragent);
> -  todo_wine ok(len == strlen(useragent),"Got wrong user agent length %d instead of %d\n",len,lstrlenA(useragent));
> +  len_ok = (len == strlen(useragent));
> +  todo_wine ok(len_ok,"Got wrong user agent length %d instead of %d\n",len,lstrlenA(useragent));
> +  if (len_ok)
> +    todo_wine ok(!strcmp(useragent,buffer),"Got wrong user agent string %s instead of %s\n",buffer,useragent);

Probably a better solution would be to actually check the return value of
InternetQueryOption before touching the returned buffers.

-- 
Dmitry.



More information about the wine-devel mailing list