Changeset 437

Show
Ignore:
Timestamp:
07/11/2005 10:58:27 AM (3 years ago)
Author:
jan
Message:

one character was not compared for the string-length was below sizeof(size_t)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.3.x/src/buffer.c

    r425 r437  
    518518        if (a->used == 0) return 1; 
    519519 
    520         for (i = a->used - 1; i < a->used && i % (sizeof(size_t)); i --) { 
     520        /* we are unsigned, if i < 0 it will flip to MAX_SIZE_T and will be > a->used */ 
     521        for (i = a->used - 1; i < a->used && i % (sizeof(size_t)); i--) { 
    521522                if (a->ptr[i] != b->ptr[i]) return 0; 
    522523        } 
     524         
     525        /* compare the single char itself which was kicked us out of the loop */  
     526        if (i < a->used && a->ptr[i] != b->ptr[i]) return 0; 
    523527         
    524528        for (i -= (sizeof(size_t)); i < a->used; i -= (sizeof(size_t))) { 
     
    526530                    *((size_t *)(b->ptr + i))) return 0; 
    527531        } 
    528  
     532         
    529533        return 1; 
    530534}