From 9041f2d1d57b6048dd6497bd42eb363b040cdf75 Mon Sep 17 00:00:00 2001 From: GetAway Date: Fri, 25 Nov 2016 08:16:15 +0100 Subject: [PATCH] fix usage of ~d (degree) & TranslateString() of a single char --- shellexec.c | 2 +- text.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/shellexec.c b/shellexec.c index 2692ebb..73383e0 100644 --- a/shellexec.c +++ b/shellexec.c @@ -8,7 +8,7 @@ #include "io.h" #include "gfx.h" -#define SH_VERSION 1.31 +#define SH_VERSION 1.32 static char CFG_FILE[128]="/var/tuxbox/config/shellexec.conf"; diff --git a/text.c b/text.c index 94f5a6c..18aaf49 100644 --- a/text.c +++ b/text.c @@ -126,21 +126,21 @@ void TranslateString(char *src, size_t size) fptr = tptr_start; tptr = src; char *tptr_end = src + size - 4; - while (*fptr && tptr < tptr_end) { + while (*fptr && tptr <= tptr_end) { if (*fptr == '~') { fptr++; int i; for (i = 0; sc[i] && (sc[i] != *fptr); i++); - if (sc[i]) { - *tptr++ = 0xC3; - *tptr++ = su[i]; - fptr++; - } else if (*fptr == 'd') { - *tptr++ = 0xC2; - *tptr++ = 0xb0; - fptr++; - } else - *tptr++ = '~'; + if (*fptr == 'd') { + *tptr++ = 0xC2; + *tptr++ = 0xb0; + fptr++; + } else if (sc[i]) { + *tptr++ = 0xC3; + *tptr++ = su[i]; + fptr++; + } else + *tptr++ = '~'; } else CopyUTF8Char(&tptr, &fptr); } -- 2.39.5