[MPlayer-dev-eng] http stream basic auth base64_encode() fix

Jeff D'Angelo jcd+mplayer at psu.edu
Tue Mar 14 20:39:20 CET 2006


On Wed, 8 Mar 2006, Reimar Döffinger wrote:

> Hi,
> On Tue, Mar 07, 2006 at 11:26:18AM -0500, Jeff D'Angelo wrote:
> > Ok, how's this attached patch look?  I added a couple speed ups to my
> > original.
>
> Fine, applied. Though you should create patches from the root of the CVS
> tree, makes it easier to apply.

Thanks, and I'll keep that in mind for the future.

Let me know if you want anything else from me for the libmpdemux/url.c
patch from March 6 (updated patch from root folder attached).

-- 
Jeff


> Greetings,
> Reimar Döffinger
>
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>
-------------- next part --------------
Index: libmpdemux/url.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/url.c,v
retrieving revision 1.30
diff -u -r1.30 url.c
--- libmpdemux/url.c	26 Nov 2005 15:57:39 -0000	1.30
+++ libmpdemux/url.c	14 Mar 2006 19:35:41 -0000
@@ -86,12 +86,15 @@
 		// We got something, at least a username...
 		int len = ptr2-ptr1;
 		Curl->username = (char*)malloc(len+1);
-		if( Curl->username==NULL ) {
+		char *usernametmp = (char*)malloc(len+1);
+		if( Curl->username==NULL || usernametmp==NULL ) {
 			mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
 			goto err_out;
 		}
-		strncpy(Curl->username, ptr1, len);
-		Curl->username[len] = '\0';
+		strncpy(usernametmp, ptr1, len);
+		usernametmp[len] = '\0';
+		url_unescape_string( Curl->username, usernametmp );
+		free(usernametmp);
 
 		ptr3 = strstr(ptr1, ":");
 		if( ptr3!=NULL && ptr3<ptr2 ) {
@@ -99,12 +102,15 @@
 			int len2 = ptr2-ptr3-1;
 			Curl->username[ptr3-ptr1]='\0';
 			Curl->password = (char*)malloc(len2+1);
-			if( Curl->password==NULL ) {
+			char *passwordtmp = (char*)malloc(len2+1);
+			if( Curl->password==NULL || passwordtmp==NULL ) {
 				mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
 				goto err_out;
 			}
-			strncpy( Curl->password, ptr3+1, len2);
-			Curl->password[len2]='\0';
+			strncpy(passwordtmp, ptr3+1, len2);
+			passwordtmp[len2]='\0';
+			url_unescape_string( Curl->password, passwordtmp );
+			free(passwordtmp);
 		}
 		ptr1 = ptr2+1;
 		pos1 = ptr1-escfilename;


More information about the MPlayer-dev-eng mailing list