Memset filename to zero first

This commit is contained in:
Pavel Krajcevski 2016-01-14 12:30:59 -05:00
parent 319b293212
commit 6cd8facf49

View file

@ -127,6 +127,7 @@ int main(int argc, char **argv) {
FasTC::Image<> diff = img1.Diff(&img2, diff_multiplier); FasTC::Image<> diff = img1.Diff(&img2, diff_multiplier);
char fname_buf [5 + 16 + 4 + 1]; // "diff-" + hash + ".png" + null char fname_buf [5 + 16 + 4 + 1]; // "diff-" + hash + ".png" + null
memset(fname_buf, 0, sizeof(fname_buf));
strncat(fname_buf, "diff-", 5); strncat(fname_buf, "diff-", 5);
gen_random(fname_buf + 5, 16); gen_random(fname_buf + 5, 16);
strncat(fname_buf + 5 + 16, ".png", 4); strncat(fname_buf + 5 + 16, ".png", 4);