From: GetAway Date: Fri, 25 Nov 2016 07:16:15 +0000 (+0100) Subject: fix usage of ~d (degree) & TranslateString() of a single char X-Git-Url: https://git.webhop.me/?a=commitdiff_plain;h=9041f2d1d57b6048dd6497bd42eb363b040cdf75;p=shellexec.git fix usage of ~d (degree) & TranslateString() of a single char --- 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); }