(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-mail/message-header-decode.c) |
| |
| 59 | | | void (const unsigned char *data, size_t size, |
| 60 | | | *callback, |
| 61 | | | void *context) |
| 62 | | | { |
| 63 | | | buffer_t *decodebuf = NULL; |
| 64 | | | unsigned int charsetlen = 0; |
| 65 | | | size_t pos, start_pos, ret; |
| 66 | | | |
| 67 | | | |
| 68 | | | start_pos = pos = 0; |
| 69 | | | for (pos = 0; pos + 1 < size; ) { |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 70 | | | if (data[pos] != '=' || data[pos+1] != '?') { |
| 71 | | | pos++; |
| 72 | | | continue; |
| 73 | | | } |
| 74 | | | |
| 75 | | | |
| 76 | | | if (pos != start_pos) { |
| 77 | | | |
| 78 | | | if (!callback(data + start_pos, pos - start_pos, |
| 79 | | | NULL, context)) { |
| 80 | | | start_pos = size; |
| 81 | | | break; |
| 82 | | | } |
| 83 | | | } |
| 84 | | | |
| 85 | | | if (decodebuf == NULL) { |
| 86 | | | decodebuf = buffer_create_dynamic(default_pool, |
| 87 | | | size - pos); |
| 88 | | | } else { |
| 89 | | | buffer_set_used_size(decodebuf, 0); |
| 90 | | | } |
| 91 | | | |
| 92 | | | pos += 2; |
| 93 | | | ret = (data + pos, size - pos, |
| 94 | | | decodebuf, &charsetlen); |
| 95 | | | if (ret == 0) { |
| 96 | | | start_pos = pos-2; |
| 97 | | | continue; |
| 98 | | | } |
| 99 | | | pos += ret; |
| 100 | | | |
| 101 | | | if (decodebuf->used > charsetlen) { |
| 102 | | | |
| 103 | | | if (!callback(CONST_PTR_OFFSET(decodebuf->data,
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
29 | #define CONST_PTR_OFFSET(ptr, offset) \ |
30 | ((const void *) (((const unsigned char *) (ptr)) + (offset))) |
| |
|
| 104 | | | charsetlen), |
| 105 | | | decodebuf->used - charsetlen, |
| 106 | | | decodebuf->data, context)) { |
| 107 | | | start_pos = size; |
| 108 | | | break; |
| 109 | | | } |
| 110 | | | } |
| 111 | | | |
| 112 | | | start_pos = pos; |
| 113 | | | } |
| 114 | | | |
| 115 | | | if (size != start_pos) { |
| 116 | | | (void)callback(data + start_pos, size - start_pos, |
| 117 | | | NULL, context); |
| 118 | | | } |
| 119 | | | if (decodebuf != NULL) |
| 120 | | | buffer_free(&decodebuf); |
| 121 | | | } |
| |