~ubuntu-branches/ubuntu/utopic/suricata/utopic

« back to all changes in this revision

Viewing changes to libhtp/htp/bstr.c

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier
  • Date: 2011-11-17 23:20:51 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20111117232051-wlo0g2fyinx0zi25
Tags: 1.1-1
* Imported Upstream version 1.1
* Add instructions on getting new rules using oinkmaster
* Add Recommends on oinkmaster
* Move snort-rules-default to Recommends

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
 * @param len
77
77
 * @return destination, at a potentially different memory location
78
78
 */
79
 
bstr *bstr_add_mem(bstr *destination, char *data, size_t len) {
80
 
    if (bstr_size(destination) < bstr_len(destination) + len) {
 
79
bstr *bstr_add_mem(bstr *destination, char *data, size_t len) {    
 
80
    if (bstr_size(destination) < bstr_len(destination) + len) {        
81
81
        destination = bstr_expand(destination, bstr_len(destination) + len);
82
 
        if (destination == NULL) return NULL;
83
 
    }
 
82
        if (destination == NULL) return NULL;        
 
83
    }    
84
84
 
85
85
    bstr_t *b = (bstr_t *) destination;
86
86
    memcpy(bstr_ptr(destination) + b->len, data, len);
87
 
    b->len = b->len + len;
 
87
    b->len = b->len + len;   
88
88
 
89
89
    return destination;
90
90
}
526
526
 
527
527
    // TODO Is an optimisation here justified?
528
528
    //      http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
529
 
 
 
529
    
530
530
    for (i = 0; i < len; i++) {
531
531
        size_t k = i;
532
532