From 4fd1af445d628b7191827a640b018315522f41d7 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Thu, 7 Mar 2013 15:21:45 -0500 Subject: [PATCH] Bash-4.2 patch 44 --- lib/glob/xmbsrtowcs.c | 14 +++++++++++++- patchlevel.h | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/glob/xmbsrtowcs.c b/lib/glob/xmbsrtowcs.c index 4d8c043..c410e05 100644 --- a/lib/glob/xmbsrtowcs.c +++ b/lib/glob/xmbsrtowcs.c @@ -216,12 +216,24 @@ xdupmbstowcs2 (destp, src) It may set 'p' to NULL. */ n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state); + if (n == 0 && p == 0) + { + wsbuf[wcnum] = L'\0'; + break; + } + /* Compensate for taking single byte on wcs conversion failure above. */ if (wcslength == 1 && (n == 0 || n == (size_t)-1)) { state = tmp_state; p = tmp_p; - wsbuf[wcnum++] = *p++; + wsbuf[wcnum] = *p; + if (*p == 0) + break; + else + { + wcnum++; p++; + } } else wcnum += wcslength; diff --git a/patchlevel.h b/patchlevel.h index 4c2cf1d..27bb4f7 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 43 +#define PATCHLEVEL 44 #endif /* _PATCHLEVEL_H_ */ -- 2.7.4