Sort of, but not to the extent that modern C shops guard their printf statements this safely. That is used when you are handling non-null terminated strings, which is very common when interacting with Fortran code.
Strictly speaking it would be a security gain in order to guard against runaway reads, perhaps you were about to printf sensitive data following a breached null character.
But
printf("%.*s", (int)sizeof(str), str);
is far worse; you just said "ignore the null character and print out the full contents anyway." Or rather, it's worse unless you're dealing with space-padded strings all the way to their memory's end, which is likely the case if the string came from Fortran.
This however is extremely important:
printf("%s", str);
as printf(str)
is a major security flaw. Read about printf attacks using the %n
specifier, which writes.