Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Upstream-Status: Backport |
| 2 | |
| 3 | From 3a05d1a920140e9f2c72791c12f664213feb46df Mon Sep 17 00:00:00 2001 |
| 4 | From: Manfred Hanke <Manfred.Hanke@tngtech.com> |
| 5 | Date: Thu, 20 Jun 2013 10:24:12 +0200 |
| 6 | Subject: [PATCH] sprintf bug (concerning %c for 8-bit character in non-UTF8 |
| 7 | mode) fixed |
| 8 | |
| 9 | char *str points to SLuchar_Type utf8_buf[], which had too small scope |
| 10 | |
| 11 | src/test/strops.sl failed in the following environment: |
| 12 | - compiler: gcc (Debian 4.7.2-5) 4.7.2 |
| 13 | - CFLAGS: -g -O2 |
| 14 | - libc: GNU C Library (Debian EGLIBC 2.13-38) stable release version 2.13 |
| 15 | - kernel: 3.2.0-4-686-pae #1 SMP Debian 3.2.39-2 i686 GNU/Linux |
| 16 | --- |
| 17 | src/slstrops.c | 2 +- |
| 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/src/slstrops.c b/src/slstrops.c |
| 21 | index ce6acb0..cbbbb01 100644 |
| 22 | --- a/src/slstrops.c |
| 23 | +++ b/src/slstrops.c |
| 24 | @@ -1884,6 +1884,7 @@ static char *SLdo_sprintf (char *fmt) /*{{{*/ |
| 25 | #endif |
| 26 | unsigned char uch; |
| 27 | int use_long = 0, use_alt_format = 0; |
| 28 | + SLuchar_Type utf8_buf[SLUTF8_MAX_MBLEN+1]; |
| 29 | |
| 30 | while (1) |
| 31 | { |
| 32 | @@ -2071,7 +2072,6 @@ static char *SLdo_sprintf (char *fmt) /*{{{*/ |
| 33 | #endif |
| 34 | { |
| 35 | SLwchar_Type wc; |
| 36 | - SLuchar_Type utf8_buf[SLUTF8_MAX_MBLEN+1]; |
| 37 | |
| 38 | if (-1 == SLang_pop_wchar (&wc)) |
| 39 | return out; |
| 40 | -- |
| 41 | 1.7.9.5 |
| 42 | |