(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mail-index-view-sync.c) |
| |
| 286 | | | static int view_sync_update_keywords(struct mail_index_view_sync_ctx *ctx, |
| 287 | | | uint32_t uid) |
| 288 | | | { |
| 289 | | | struct thdr; |
| 290 | | | struct mail_transaction_keyword_update kw_up; |
| 291 | | | const unsigned int *kw_idx; |
| 292 | | | const char *const *kw_names; |
| 293 | | | unsigned int i, count; |
| 294 | | | |
| 295 | | | kw_idx = array_get(&ctx->lost_new_kw, &count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
156 | #define array_get(array, count) \ |
157 | ARRAY_TYPE_CAST_CONST(array)array_get_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
43 | # define ARRAY_TYPE_CAST_CONST(array) \ |
44 | (typeof(*(array)->v)) |
| |
|
| 296 | | | if (count == 0) |
| 297 | | | return 0; |
| 298 | | | kw_names = array_idx(&ctx->view->index->keywords, 0);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
165 | #define array_idx(array, idx) \ |
166 | ARRAY_TYPE_CAST_CONST(array)array_idx_i(&(array)->arr, idx) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
43 | # define ARRAY_TYPE_CAST_CONST(array) \ |
44 | (typeof(*(array)->v)) |
| |
|
| 299 | | | |
| 300 | | | memset(&thdr, 0, sizeof(thdr)); |
| 301 | | | thdr.type = MAIL_TRANSACTION_KEYWORD_UPDATE | MAIL_TRANSACTION_EXTERNAL; |
| 302 | | | memset(&kw_up, 0, sizeof(kw_up)); |
| 303 | | | kw_up.modify_type = MODIFY_ADD; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 304 | | | |
| 305 | | | for (i = 0; i < count; i++) { |
| 306 | | | kw_up.name_size = strlen(kw_names[kw_idx[i]]); |
| 307 | | | buffer_set_used_size(ctx->lost_kw_buf, 0); |
| 308 | | | buffer_append(ctx->lost_kw_buf, &kw_up, sizeof(kw_up)); |
| 309 | | | buffer_append(ctx->lost_kw_buf, kw_names[kw_idx[i]], |
| 310 | | | kw_up.name_size); |
| 311 | | | if (ctx->lost_kw_buf->used % 4 != 0) { |
| 312 | | | buffer_append_zero(ctx->lost_kw_buf, |
| 313 | | | 4 - ctx->lost_kw_buf->used % 4); |
| 314 | | | } |
| 315 | | | buffer_append(ctx->lost_kw_buf, &uid, sizeof(uid)); |
| 316 | | | buffer_append(ctx->lost_kw_buf, &uid, sizeof(uid)); |
| 317 | | | |
| 318 | | | thdr.size = ctx->lost_kw_buf->used; |
| 319 | | | if (mail_index_sync_record(&ctx->sync_map_ctx, &thdr, |
| 320 | | | ctx->lost_kw_buf->data) < 0) |
| 321 | | | return -1; |
| 322 | | | } |
| 323 | | | return 0; |
| 324 | | | } |
| |