~ubuntu-branches/ubuntu/lucid/curl/lucid-security

« back to all changes in this revision

Viewing changes to lib/http_chunks.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2009-04-29 11:10:29 UTC
  • mfrom: (3.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090429111029-2j5eiyokfw2bw049
Tags: 7.19.4-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop build dependencies: stunnel, libdb4.6-dev, libssh2-1-dev
  - Add build-dependency on openssh-server
  - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.
  - Call automake-1.9 with --add-missing --copy --force
* drop debian/patches/security_CVE-2009-0037.patch 
  - this patch is part of 7.19.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: http_chunks.c,v 1.43 2008-01-31 12:04:33 bagder Exp $
 
21
 * $Id: http_chunks.c,v 1.47 2008-10-24 01:27:00 yangtse Exp $
22
22
 ***************************************************************************/
23
23
#include "setup.h"
24
24
 
81
81
 
82
82
 */
83
83
 
 
84
/* Check for an ASCII hex digit.
 
85
 We avoid the use of isxdigit to accommodate non-ASCII hosts. */
 
86
static bool Curl_isxdigit(char digit)
 
87
{
 
88
  return (bool)( (digit >= 0x30 && digit <= 0x39)    /* 0-9 */
 
89
              || (digit >= 0x41 && digit <= 0x46)    /* A-F */
 
90
              || (digit >= 0x61 && digit <= 0x66) ); /* a-f */
 
91
}
84
92
 
85
93
void Curl_httpchunk_init(struct connectdata *conn)
86
94
{
127
135
  while(length) {
128
136
    switch(ch->state) {
129
137
    case CHUNK_HEX:
130
 
      /* Check for an ASCII hex digit.
131
 
         We avoid the use of isxdigit to accommodate non-ASCII hosts. */
132
 
      if((*datap >= 0x30 && *datap <= 0x39)    /* 0-9 */
133
 
         || (*datap >= 0x41 && *datap <= 0x46)    /* A-F */
134
 
         || (*datap >= 0x61 && *datap <= 0x66)) { /* a-f */
 
138
      if(Curl_isxdigit(*datap)) {
135
139
        if(ch->hexindex < MAXNUM_SIZE) {
136
140
          ch->hexbuffer[ch->hexindex] = *datap;
137
141
          datap++;
305
309
        char *ptr;
306
310
        if(conn->trlMax) {
307
311
          conn->trlMax *= 2;
308
 
          ptr = (char*)realloc(conn->trailer,conn->trlMax);
 
312
          ptr = realloc(conn->trailer,conn->trlMax);
309
313
        }
310
314
        else {
311
315
          conn->trlMax=128;
312
 
          ptr = (char*)malloc(conn->trlMax);
 
316
          ptr = malloc(conn->trlMax);
313
317
        }
314
318
        if(!ptr)
315
319
          return CHUNKE_OUT_OF_MEMORY;