GCC seems to lose track of possible output lengths of the first sprintf() when computing possible lengths of the second. ../mbbioDirectTest.c:44:26: warning: ‘.B’ directive writing 2 bytes into a region of size between 1 and 40 [-Wformat-overflow=] 44 | sprintf(field,"%s.B%X", rec, i);