Hi,

Attached patch helps dealing with not-found headers when building authentication responses in call::process_incoming() (strcpy doesn't like NULL's).

Cheers,
Bogdan

Index: call.cpp
===================================================================
--- call.cpp	(revision 195)
+++ call.cpp	(working copy)
@@ -3056,13 +3056,16 @@
       /* is a challenge */
       char auth[MAX_HEADER_LEN];
       memset(auth, 0, sizeof(auth));
-      strcpy(auth, get_header_content(msg, (char*)"Proxy-Authenticate:"));
-      if (auth[0] == 0) {
-        strcpy(auth, get_header_content(msg, (char*)"WWW-Authenticate:"));
-      }
-      if (auth[0] == 0) {
-        ERROR("Couldn't find 'Proxy-Authenticate' or 'WWW-Authenticate' in 401 or 407!");
-      }
+	char * ret = get_header_content(msg, (char*)"Proxy-Authenticate:");
+	if (ret) {
+		strcpy(auth, ret);
+	} else {
+		ret = get_header_content(msg, (char*)"WWW-Authenticate:");
+		if (ret)
+			strcpy(auth, ret);
+		else
+			ERROR("Couldn't find 'Proxy-Authenticate' or 'WWW-Authenticate' in 401 or 407!");
+	}
 
       dialog_authentication = (char *) calloc(1, strlen(auth) + 2);
       sprintf(dialog_authentication, "%s", auth);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to