[Icecast-dev] Bug in auth.c

Martin Matuska martin at matuska.org
Sat Sep 10 08:27:17 PDT 2005


The function check_duplicate_logins in auth.c (2.3.0.rc2) contains a
bug. The client object passed to the function gets overwritten inside
it, and a the comparsion "strcmp (client->username, client->username) ==
0" always returns zero, so any username is always considered duplicate.

Patch suggestion attached.
-------------- next part --------------
--- src/auth.c.orig	Sat Sep 10 16:44:43 2005
+++ src/auth.c	Sat Sep 10 17:19:28 2005
@@ -238,8 +238,8 @@
         node = avl_get_first (source->client_tree);
         while (node)
         {   
-            client_t *client = (client_t *)node->key;
-            if (client->username && strcmp (client->username, client->username) == 0)
+            client_t *existing_client = (client_t *)node->key;
+            if (existing_client->username && strcmp (existing_client->username, client->username) == 0)
             {
                 avl_tree_unlock (source->client_tree);
                 return 0;
@@ -252,8 +252,8 @@
         node = avl_get_first (source->pending_tree);
         while (node)
         {
-            client_t *client = (client_t *)node->key;
-            if (client->username && strcmp (client->username, client->username) == 0)
+            client_t *existing_client = (client_t *)node->key;
+            if (existing_client->username && strcmp (existing_client->username, client->username) == 0)
             {
                 avl_tree_unlock (source->pending_tree);
                 return 0;


More information about the Icecast-dev mailing list