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

INN Commit rra at isc.org
Sun Nov 15 09:24:34 UTC 2009


    Date: Sunday, November 15, 2009 @ 01:24:33
  Author: iulius
Revision: 8779

Fix a memory leak in the LISTGROUP command when the provided
range is invalid.  And in GROUP/LISTGROUP commands when
the client does not have read access.

Modified:
  branches/2.5/nnrpd/group.c

---------+
 group.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Modified: group.c
===================================================================
--- group.c	2009-11-15 09:24:25 UTC (rev 8778)
+++ group.c	2009-11-15 09:24:33 UTC (rev 8779)
@@ -13,6 +13,7 @@
 /*
 **  Change to or list the specified newsgroup.  If invalid, stay in the old
 **  group.
+**  Do not forget to free(group) before any return after "group" has been set.
 */
 void
 CMDgroup(int ac, char *av[])
@@ -44,9 +45,10 @@
 	group = xstrdup(av[1]);
     }
 
-    /* Check whether the second argument is valid. */
+    /* Check whether the second argument is valid (for LISTGROUP). */
     if (ac == 3 && !IsValidRange(av[2])) {
-        Reply("%d Syntax error\r\n", NNTP_ERR_SYNTAX);
+        Reply("%d Syntax error in range\r\n", NNTP_ERR_SYNTAX);
+        free(group);
         return;
     }
 
@@ -54,6 +56,7 @@
     if (!hookpresent && !PERMcanread) {
         Reply("%d Read access denied\r\n",
               PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
+        free(group);
         return;
     }
 




More information about the inn-committers mailing list