From: Magnus Olsen Date: Sun, 4 Feb 2007 18:17:34 +0000 (+0000) Subject: fixed a problem possible overwrite memory in cmd. base on knowlges from bug 2017... X-Git-Tag: backups/alex-kd-branch@25995~25^2~30^2~15 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=b27a0418ec7d79234f69fdd4b83f534fd89169e7;ds=sidebyside fixed a problem possible overwrite memory in cmd. base on knowlges from bug 2017. the patch are incorrect to fix it. we simple do not allown overwrite the memory. See issue #2017 for more details. svn path=/branches/ros-branch-0_3_1/; revision=25718 --- diff --git a/reactos/base/shell/cmd/cmd.c b/reactos/base/shell/cmd/cmd.c index 526d01b75a4..08b11e60b83 100644 --- a/reactos/base/shell/cmd/cmd.c +++ b/reactos/base/shell/cmd/cmd.c @@ -187,6 +187,9 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperato INT c = 0; INT n = 0; + if (len <= 1) + return 0; + if (num.QuadPart == 0) { des[0] = _T('0'); @@ -203,6 +206,8 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperato temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0'); num.QuadPart /= 10; } + if (c>len) + c=len; for (n = 0; n <= c; n++) des[n] = temp[31 - c + n];