INN commit: branches/2.5/nnrpd (list.c)

INN Commit rra at isc.org
Tue Mar 23 18:30:58 UTC 2010


    Date: Tuesday, March 23, 2010 @ 11:30:58
  Author: iulius
Revision: 9030

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

Modified:
  branches/2.5/nnrpd/list.c

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

Modified: list.c
===================================================================
--- list.c	2010-03-21 20:11:13 UTC (rev 9029)
+++ list.c	2010-03-23 18:30:58 UTC (rev 9030)
@@ -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