[Python-checkins] cpython: Fix off-by-one error.

brian.curtin python-checkins at python.org
Fri Jun 22 00:13:07 CEST 2012


http://hg.python.org/cpython/rev/d4e744d79e67
changeset:   77550:d4e744d79e67
user:        Martin v. Löwis <martin at v.loewis.de>
date:        Thu Jun 21 17:36:15 2012 +0200
summary:
  Fix off-by-one error.

files:
  PC/launcher.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/PC/launcher.c b/PC/launcher.c
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -63,7 +63,7 @@
     static wchar_t buf[256];
     DWORD result = GetEnvironmentVariableW(key, buf, 256);
 
-    if (result > 256) {
+    if (result > 255) {
         /* Large environment variable. Accept some leakage */
         wchar_t *buf2 = (wchar_t*)malloc(sizeof(wchar_t) * (result+1));
         GetEnvironmentVariableW(key, buf2, result);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list