From: Ralph Corderoy Date: Fri, 8 Sep 2017 13:12:51 +0000 (+0100) Subject: base64.c: Don't out-of-bounds printf("%s", &encoded[-1]). X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/1e5cdbdd102555b43fc3ffa9a45ba9e7a833c190?ds=inline;hp=1e5cdbdd102555b43fc3ffa9a45ba9e7a833c190 base64.c: Don't out-of-bounds printf("%s", &encoded[-1]). `cp' is walking through encoded[] when an error occurs and is stepped back up to 20 elements to provide some lead-in context for the error message. If might be stepped back to encoded-1, but it attempts to cope with that by `cp ? cp : encoded'. cp is always non-NULL so true and cp is printed. Presumably, `cp > encoded' was meant. But it's all a bit of a rigmarole so just use min() instead to ensure cp stays within encoded and print cp. Fixes bfc6b93af. ---