Text   |  XML   |  ReML   |   Visible Warnings:

Unreasonable Size Argument  at buffer.c:252

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

mbox_sync_move_buffer

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/mbox/mbox-sync-update.c)expand/collapse
Show more  
 29  void mbox_sync_move_buffer(struct mbox_sync_mail_context *ctx,
 30                             size_t pos, size_t need, size_t have)
 31  {
 32          ssize_t diff = (ssize_t)need - (ssize_t)have;
 33          int i;
 34   
 35          i_assert(have < SSIZE_T_MAX);
 36   
 37          if (diff == 0) {
 38                  if (ctx->header_last_change < pos + have ||
 39                      ctx->header_last_change == (size_t)-1)
 40                          ctx->header_last_change = pos + have;
 41          } else {
 42                  /* FIXME: if (diff < ctx->space && pos < ctx->offset) then 
 43                     move the data only up to space offset and give/take the 
 44                     space from there. update header_last_change accordingly.
 45                     (except pos and offset can't be compared directly) */
 46                  ctx->header_last_change = (size_t)-1;
 47                  for (i = 0; i < MBOX_HDR_COUNT; i++) {
 48                          if (ctx->hdr_pos[i] > pos &&
 49                              ctx->hdr_pos[i] != (size_t)-1)
 50                                  ctx->hdr_pos[i] += diff;
 51                  }
 52   
 53                  if (ctx->mail.space > 0) {
 54                          i_assert(ctx->mail.offset + ctx->mail.space <=
 55                                   ctx->hdr_offset + pos ||
 56                                   ctx->mail.offset > ctx->hdr_offset + pos + have);
 57                          if (ctx->mail.offset > ctx->hdr_offset + pos) {
 58                                  /* free space offset moves */
 59                                  ctx->mail.offset += diff;
 60                          }
 61                  }
 62   
 63                  if (diff < 0)
 64                          str_delete(ctx->header, pos, -diff);
 65                  else {
 66                          ctx->header_last_change = (size_t)-1;
 67                          buffer_copy(ctx->header, pos + diff,
 68[+]                                     ctx->header, pos, (size_t)-1);
expand/collapse

buffer_copy

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/buffer.c)expand/collapse
Show more  
 236  void buffer_copy(buffer_t *_dest, size_t dest_pos,
 237                   const buffer_t *_src, size_t src_pos, size_t copy_size)
 238  {
 239          struct real_buffer *dest = (struct real_buffer *)_dest;
 240          const struct real_buffer *src = (const struct real_buffer *)_src;
 241          size_t max_size;
 242   
 243          i_assert(src_pos <= src->used);
 244   
 245          max_size = src->used - src_pos;
 246          if (copy_size > max_size)
 247                  copy_size = max_size;
 248   
 249          buffer_check_limits(dest, dest_pos, copy_size);
 250          if (src == dest) {
 251                  memmove(dest->w_buffer + dest_pos,
 252                          src->r_buffer + src_pos, copy_size);
Show more  
Show more  




Change Warning 7401.24492 : Unreasonable Size Argument

Priority:
State:
Finding:
Owner:
Note: