[MPlayer-dev-eng] http stream basic auth base64_encode() fix
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Mar 14 20:55:45 CET 2006
Hi,
On Tue, Mar 14, 2006 at 02:39:20PM -0500, Jeff D'Angelo wrote:
> 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).
Hmm... Somehow didn't even see that one...
> @@ -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);
IMHO Ugly. Still ugly, but maybe better:
Just do url_unescape_string( Curl->username, Curl->username );
But maybe best (if it works, I think it should):
*ptr2 = 0;
and replace the strncpy by url_unescape_string.
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list