From: Karel Zak Date: Tue, 6 Sep 2011 01:18:46 +0000 (+0200) Subject: write: fix path for freopen() X-Git-Tag: v2.21-rc1~463 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b89fdd9c05a6e5f12ab56441389e5ee9d1d7f30f;p=thirdparty%2Futil-linux.git write: fix path for freopen() Reported-by: xinglp Signed-off-by: Karel Zak --- diff --git a/term-utils/write.c b/term-utils/write.c index a825f62476..a70eb7bd1d 100644 --- a/term-utils/write.c +++ b/term-utils/write.c @@ -322,7 +322,7 @@ void do_write(char *tty, char *mytty, uid_t myuid) if (strlen(tty) + 6 > sizeof(path)) errx(EXIT_FAILURE, _("tty path %s too long"), tty); - printf(path, "/dev/%s", tty); + snprintf(path, sizeof(path), "/dev/%s", tty); if ((freopen(path, "w", stdout)) == NULL) err(EXIT_FAILURE, "%s", path);