From: Todd C. Miller Date: Sat, 12 Nov 2011 18:08:13 +0000 (-0500) Subject: Don't print garbage at the end of the custom lecture. X-Git-Tag: SUDO_1_8_4~159^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f190bcf94b066d64c0d21b55bc72f149be90522c;p=sudo Don't print garbage at the end of the custom lecture. --- diff --git a/plugins/sudoers/check.c b/plugins/sudoers/check.c index bda53a84f..7d74bab63 100644 --- a/plugins/sudoers/check.c +++ b/plugins/sudoers/check.c @@ -212,7 +212,7 @@ lecture(int status) if (def_lecture_file && (fp = fopen(def_lecture_file, "r")) != NULL) { while ((nread = fread(buf, sizeof(char), sizeof(buf) - 1, fp)) != 0) { - buf[sizeof(buf) - 1] = '\0'; + buf[nread] = '\0'; msg.msg_type = SUDO_CONV_ERROR_MSG; msg.msg = buf; sudo_conv(1, &msg, &repl);