INN commit: trunk/nnrpd (group.c)

INN Commit rra at isc.org
Wed Nov 4 22:04:08 UTC 2009


    Date: Wednesday, November 4, 2009 @ 14:04:08
  Author: iulius
Revision: 8707

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:
  trunk/nnrpd/group.c

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

Modified: group.c
===================================================================
--- group.c	2009-11-04 22:01:50 UTC (rev 8706)
+++ group.c	2009-11-04 22:04:08 UTC (rev 8707)
@@ -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