]> granicus.if.org Git - sudo/commitdiff
Don't print garbage at the end of the custom lecture.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 12 Nov 2011 18:08:13 +0000 (13:08 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 12 Nov 2011 18:08:13 +0000 (13:08 -0500)
plugins/sudoers/check.c

index bda53a84fe6419a59bfc3b3d82630728297987b7..7d74bab63fa072ba516da087f5b36c9f482b610f 100644 (file)
@@ -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);