- Debian bug is Bug#861537 - when constructing a custom detox "translation table" with the fall through option (no default specified, or "default" without a value), detox creates malformed characters in the output - every "clean_*" code path is effected.
- clean_iso8859_1() and clean_safe() methods have simple change to fix this bug. - clean_utf_8() still to be done - Thank you to Vasily Kolobkov <polezaivs...@openmailbox.org> for the fix, I am a mere Java programmer still learning C. --- src/clean_string.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/clean_string.c b/src/clean_string.c index 7aa054e..f1a75ba 100644 --- a/src/clean_string.c +++ b/src/clean_string.c @@ -131,16 +131,15 @@ unsigned char *clean_iso8859_1(unsigned char *s, void *opts) * Null translation == leave it alone */ *output_walk++ = *input_walk++; + continue; } else { replace_walk = table->default_translation; } } - if (replace_walk != NULL) { - while (*replace_walk != '\0') { - *output_walk++ = *replace_walk++; - } + while (*replace_walk != '\0') { + *output_walk++ = *replace_walk++; } input_walk++; @@ -296,16 +295,15 @@ unsigned char *clean_safe(unsigned char *s, void *opts) * Null translation == leave it alone */ *output_walk++ = *input_walk++; + continue; } else { replace_walk = table->default_translation; } } - if (replace_walk != NULL) { - while (*replace_walk != '\0') { - *output_walk++ = *replace_walk++; - } + while (*replace_walk != '\0') { + *output_walk++ = *replace_walk++; } input_walk++; -- 2.9.0