Changeset 5053


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

(1.0x) #713: handle leading spaces in the announce url more gracefully

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.0x/libtransmission/metainfo.c

    r4404 r5053  
    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
     
    482484    if( !inf->trackerTiers )
    483485    {
    484 
    485         if( tr_httpParseUrl( val->val.s.s, val->val.s.i,
    486                              &address, &port, &announce ) )
     486        char buf[4096], *pch;
     487        strlcpy( buf, val->val.s.s, sizeof( buf ) );
     488        pch = buf;
     489        while( isspace( *pch ) )
     490            ++pch;
     491
     492        if( tr_httpParseUrl( pch, -1, &address, &port, &announce ) )
    487493        {
    488494            tr_err( "Invalid announce URL (%s)", val->val.s.s );
Note: See TracChangeset for help on using the changeset viewer.