about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-23 12:34:30 -0500
committerJune McEnroe <june@causal.agency>2021-01-23 12:34:30 -0500
commitbc29082f9d904b1996cb269d70e474b91cc608ef (patch)
treefb5dd8ced5c227ccc58b94d0d267d0a83d73c3e9
parentDrop filesystem access iff possible (diff)
downloadcatgirl-bc29082f9d904b1996cb269d70e474b91cc608ef.tar.gz
catgirl-bc29082f9d904b1996cb269d70e474b91cc608ef.zip
Remove use of "%n" to appease de Raadt
Sure, it was completely unnecessary, but I resent being told how
to use snprintf.

https://cvsweb.openbsd.org/src/lib/libc/stdio/vfprintf.c?rev=1.79&content-type=text/x-cvsweb-markup
Notes
My problem here is with yelling about a standard C feature that has legitimate uses, simply because it *could* be used in a way that might cause security issues. If you're going to do that, you may as well syslog(3) whenever someone runs any C code at all.
-rw-r--r--buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index ef175b8..41a84cc 100644
--- a/buffer.c
+++ b/buffer.c
@@ -185,7 +185,7 @@ static int flow(struct Lines *hard, int cols, const struct Line *soft) {
 		if (!line->str) err(EX_OSERR, "malloc");
 
 		struct Cat cat = { line->str, cap, 0 };
-		catf(&cat, "%*s%n", align, "", &width);
+		catf(&cat, "%*s", (width = align), "");
 		styleCat(&cat, wrapStyle);
 		str = &line->str[cat.len];
 		style = wrapStyle;