INN commit: trunk/nnrpd (list.c)

INN Commit rra at isc.org
Sun Mar 21 17:18:04 UTC 2010


    Date: Sunday, March 21, 2010 @ 10:18:04
  Author: iulius
Revision: 9026

Enforce UTF-8 for LIST MOTD and LIST DISTRIBUTIONS responses.

Modified:
  trunk/nnrpd/list.c

--------+
 list.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Modified: list.c
===================================================================
--- list.c	2010-03-21 16:49:41 UTC (rev 9025)
+++ list.c	2010-03-21 17:18:04 UTC (rev 9026)
@@ -272,7 +272,12 @@
             continue;
         }
         if (lp == &INFOmotd) {
-            Printf("%s\r\n", p);
+            if (is_valid_utf8(p)) {
+                Printf("%s\r\n", p);
+            } else {
+                syslog(L_ERROR, "%s bad encoding in %s (UTF-8 expected)",
+                       Client.host, lp->File);
+            }
             continue;
         }
 	/* Matching patterns against patterns is not that
@@ -296,8 +301,14 @@
 	    continue;
 	}
 	if (lp == &INFOdistribs || lp == &INFOmoderators) {
-	    if (*p != '\0' && *p != '#' && *p != ';' && *p != ' ')
-		Printf("%s\r\n", p);
+            if (*p != '\0' && *p != '#' && *p != ';' && *p != ' ') {
+                if (is_valid_utf8(p)) {
+                    Printf("%s\r\n", p);
+                } else if (lp == &INFOdistribs) {
+                    syslog(L_ERROR, "%s bad encoding in %s (UTF-8 expected)",
+                           Client.host, lp->File);
+                }
+            }
 	    continue;
 	}
 	savec = '\0';




More information about the inn-committers mailing list