New registry key adding patch

Dimitrie O. Paun dpaun at rogers.com
Thu Jan 1 05:17:40 CST 2004


On January 1, 2004 06:41 am, Zimler Attila wrote:
> This is working while "key name" string is not localized. 
> After that this could introduce security bugs. 
> Will it be localized? How to deal with situations like this?

Well, we would need to allocate the buffer dynamically anyway.

Please use uniffied diffs (diff -u) when submitting patches.

> +     /* try to find out a name for the newly create key.
> +       We try it max 100 times. */
> +     sprintf(keyName, "new key");

You don't need this sprintf here

> +     lRet = RegOpenKey(hKey, keyName, &retKey);
> +     while (lRet == ERROR_SUCCESS && keyNum < 100) {
> +           sprintf(keyName, "new key %u", ++keyNum);
> +           lRet = RegOpenKey(hKey, keyName, &retKey);
> +     }
> +     if (lRet != ERROR_SUCCESS) return FALSE;

This condition is not right. We exit the loop when
lRet != ERROR_SUCCESS which means we always return FALSE.

-- 
Dimi.




More information about the wine-devel mailing list