changeset 12563:b7f7f3a685ea

[gaim-migrate @ 14882] Fix an "off by one" parsing error when parsing the nonce token. I haven't actually tested this, but this should hopefully fix bug #1385135. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 19 Dec 2005 15:17:19 +0000
parents e3b4abe7e0f8
children 01e18ead06a0
files src/protocols/simple/simple.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/simple/simple.c	Mon Dec 19 14:24:40 2005 +0000
+++ b/src/protocols/simple/simple.c	Mon Dec 19 15:17:19 2005 +0000
@@ -342,10 +342,10 @@
 	auth->type = 1;
 	parts = g_strsplit(hdr, " ", 0);
 	while(parts[i]) {
-		if(!strncmp(parts[i],"nonce",5)) {
-			auth->nonce = g_strndup(parts[i]+7,strlen(parts[i]+7)-1);
+		if(!strncmp(parts[i], "nonce", 5)) {
+			auth->nonce = g_strndup(parts[i]+7,strlen(parts[i]+7)-2);
 		}
-		if(!strncmp(parts[i],"realm",5)) {
+		else if(!strncmp(parts[i], "realm", 5)) {
 			auth->realm = g_strndup(parts[i]+7,strlen(parts[i]+7)-2);
 		}
 		i++;
@@ -516,14 +516,14 @@
 	if(addheaders) addh=addheaders;
 	if(sip->registrar.type && !strcmp(method,"REGISTER")) {
 		buf = auth_header(sip, &sip->registrar, method, url);
-		auth = g_strdup_printf("Authorization: %s",buf);
+		auth = g_strdup_printf("Authorization: %s", buf);
 		g_free(buf);
 		gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth);
 	}
 
 	if(sip->proxy.type && strcmp(method,"REGISTER")) {
 		buf = auth_header(sip, &sip->proxy, method, url);
-		auth = g_strdup_printf("Proxy-Authorization: %s",buf);
+		auth = g_strdup_printf("Proxy-Authorization: %s", buf);
 		g_free(buf);
 		gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth);
 	}