commit 06ed0943b4ffd56be1323c336f0cb52379ccd6d1 from: Sven M. Hallberg date: Thu Apr 13 17:31:08 2023 UTC fix format specifier for printing HBytes Since HBytes is a length/pointer pair and not a null-terminated string, we must pass the length as an argument to printf. The correct format specifier for that is "%.*s" (string with "precision" = length), not "%*s" (string with minimum field width). commit - 11e873cc864fe2d1d96d72b11374e34b553412b3 commit + 06ed0943b4ffd56be1323c336f0cb52379ccd6d1 blob - f0eac27c4067b2d1ee299fb19f96960f7a934493 blob + b3101781628c5c931c9a0750970592b9f7721710 --- pdf.c +++ pdf.c @@ -1091,7 +1091,7 @@ validate_dict_(HParseResult *p, void *u) kj = H_INDEX_BYTES(seq->elements[j], 0); if (bytescmp(ki, kj) == 0) { - log_message(7, "duplicate key /%*s in " + log_message(7, "duplicate key /%.*s in " "dictionary\n", (int)ki.len, ki.token); return false; } @@ -4530,7 +4530,7 @@ act_ks_value(const HParseResult *p, void *u) b = v->bytes; if (b.len > INT_MAX) b.len = INT_MAX; - log_message(7, "parse error in stream (type %*s)\n", + log_message(7, "parse error in stream (type %.*s)\n", (int)b.len, b.token); } return H_MAKE(HParseResult, res);