Changeset 5052


Ignore:
Timestamp:
Feb 18, 2008, 5:06:52 AM (14 years ago)
Author:
charles
Message:

#713: handle leading spaces in the announce url more gracefully

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/metainfo.c

    r5041 r5052  
    2424
    2525#include <assert.h>
     26#include <ctype.h> /* isspace */
    2627#include <errno.h>
    2728#include <stdio.h>
     
    3940#include "metainfo.h"
    4041#include "platform.h"
     42#include "trcompat.h" /* strlcpy */
    4143#include "utils.h"
    4244
     
    495497    if( !inf->trackerTiers )
    496498    {
    497 
    498         if( tr_httpParseUrl( val->val.s.s, val->val.s.i,
    499                              &address, &port, &announce ) )
     499        char buf[4096], *pch;
     500        strlcpy( buf, val->val.s.s, sizeof( buf ) );
     501        pch = buf;
     502        while( isspace( *pch ) )
     503            ++pch;
     504
     505        if( tr_httpParseUrl( pch, -1, &address, &port, &announce ) )
    500506        {
    501507            tr_err( "Invalid announce URL (%s)", val->val.s.s );
Note: See TracChangeset for help on using the changeset viewer.