~ubuntu-branches/ubuntu/trusty/libhtp/trusty-proposed

« back to all changes in this revision

Viewing changes to htp/htp_decompressors.c

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier
  • Date: 2012-11-03 09:23:06 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20121103092306-1mlez1c0xf0ic8t8
Tags: 0.2.10-1
* Imported Upstream version 0.2.10
* Update watch file
* Update symbols file
* Bump Standards Version
* Convert to DH 9
  - add multiarch support
  - fully enable hardening flags
* Debian release 0.2.10-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
                return -1;
42
42
            }
43
43
 
44
 
            if (d->data[3] != 0) {
 
44
            if (d->data[3] == 0) {
 
45
                drec->initialized = 1;
 
46
                consumed = 10;
 
47
            } else if (d->data[3] & (1 << 3) || d->data[3] & (1 << 4)) {
 
48
                /* skip past
 
49
                 * - FNAME 0x3 extension, which is a name ended in a NUL terminator
 
50
                 * or
 
51
                 * - FCOMMENT 0x4 extension, which is a commend ended in a NULL terminator
 
52
                 */
 
53
 
 
54
                size_t len;
 
55
                for (len = 10; len < d->len && d->data[len] != '\0'; len++);
 
56
 
 
57
                drec->initialized = 1;
 
58
                consumed = len + 1;
 
59
            } else {
45
60
                htp_log(d->tx->connp, HTP_LOG_MARK, HTP_LOG_WARNING, 0,
46
61
                    "GZip decompressor: Unable to handle flags: %d", d->data[3]);
47
62
                drec->initialized = -1;
48
63
                return -1;
49
64
            }
50
 
 
51
 
            drec->initialized = 1;
52
 
            consumed = 10;
53
65
        } else {
54
66
            // We do not (or did not) have enough bytes, so we have
55
67
            // to copy some data into our internal header buffer.