Skip Menu |

This queue is for tickets about the Win32API-Registry CPAN distribution.

Report information
The Basics
Id: 37749
Status: resolved
Priority: 0/
Queue: Win32API-Registry

People
Owner: Nobody in particular
Requestors: DDICK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.30
Fixed in: (no value)



Subject: RegQueryValueEx can cause perl to crash. Patch attached
if RegQueryValueEx is used to get a value of length 0, any access of that value causes perl to crash. Patch attachedif RegQueryValueEx is used to get a value of length 0, any access of that value causes perl to crash. Patch attached. A registry value of length 0 can be created with Win32API::Registry::RegSetValueEx($key, $name, 0, Win32API::Registry::REG_SZ(), '');
Subject: win32api_registry_empty_string.patch
diff -Naur old/Registry.xs new/Registry.xs --- old/Registry.xs 2008-05-22 21:35:29.000000000 +1000 +++ new/Registry.xs 2008-07-17 12:12:07.000000000 +1000 @@ -903,6 +903,7 @@ /* Traim trailing '\0' from REG*_SZ values if iolData was C<[]>: */ if( RETVAL && NULL != opData && NULL != ouType && ( REG_SZ == *ouType || REG_EXPAND_SZ == *ouType ) + && *iolData >= 1 && null_arg(ST(5)) && '\0' == opData[*iolData-1] ) --*iolData; OUTPUT: @@ -940,6 +941,7 @@ if( RETVAL && NULL != opData && NULL != ouType && ( REG_SZ == *ouType || REG_EXPAND_SZ == *ouType ) && null_arg(ST(5)) + && *iolData >= sizeof(WCHAR) && L'\0' == ((WCHAR *)opData)[(*iolData/sizeof(WCHAR))-1] ) *iolData -= sizeof(WCHAR); OUTPUT:
duplicate