[Gd-chatter] r11077 - trunk/fundev/sources/win32/win32-registry

andreas at gwydiondylan.org andreas at gwydiondylan.org
Tue Dec 19 22:49:46 CET 2006


Author: andreas
Date: Tue Dec 19 22:49:45 2006
New Revision: 11077

Modified:
   trunk/fundev/sources/win32/win32-registry/regutil.dylan
Log:
job: minor

Fix the fix: ensure the result buffer is big enough.

Modified: trunk/fundev/sources/win32/win32-registry/regutil.dylan
==============================================================================
--- trunk/fundev/sources/win32/win32-registry/regutil.dylan	(original)
+++ trunk/fundev/sources/win32/win32-registry/regutil.dylan	Tue Dec 19 22:49:45 2006
@@ -35,7 +35,7 @@
 
 define method register-item(subkey1 :: <byte-string>, subkey2 :: <byte-string>,
 			    subkey3 :: <byte-string>, value :: <string>)
-  let max-key-size = reduce1(\+, map(size, list(subkey1, subkey2, subkey3))) + 1;
+  let max-key-size = min(reduce1(\+, map(size, list(subkey1, subkey2, subkey3))) + 1, 1000);
   with-stack-structure( key-buf :: <LPTSTR>, size: max-key-size)
     let start-id = append-c-string(key-buf, subkey1 );
     let end-id = append-c-string(start-id, subkey2);
@@ -60,7 +60,7 @@
 				subkey2 :: <byte-string>,
 				subkey3 :: <byte-string>)
  => (value :: false-or(<string>));
-  let max-key-size = reduce1(\+, map(size, list(subkey1, subkey2, subkey3))) + 1;
+  let max-key-size = min(reduce1(\+, map(size, list(subkey1, subkey2, subkey3))) + 1, 1000);
   with-stack-structure( key-buf :: <LPTSTR>, size: max-key-size)
   with-stack-structure( value-buf :: <LPTSTR>, size: max-key-size)
   with-stack-structure( size-ptr :: <PLONG> )



More information about the chatter mailing list