From 9f532321d0bb88fc1bd321de44c89c64122acceb Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 21 Dec 2015 11:22:55 +0100 Subject: [PATCH] msvcrt: Return error if last known character is further in the string then current character. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcrt/mbcs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index e7adaad633a..56945bbb382 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -520,6 +520,9 @@ unsigned int CDECL _mbcjmstojis(unsigned int c) */ unsigned char* CDECL _mbsdec(const unsigned char* start, const unsigned char* cur) { + if(start >= cur) + return NULL; + if(get_mbcinfo()->ismbcodepage) return (unsigned char *)(_ismbstrail(start,cur-1) ? cur - 2 : cur -1);