Subject: | RegQueryValueEx on an empty value causes a crash. Patch included. |
If RegQueryValueEx returns an empty string, it causes a crash when the
value is accessed. Patch fixes issue.
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 11:13:09.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: