Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at message-decoder.c:200

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

message_decode_body

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-mail/message-decoder.c)expand/collapse
Show more  
 249  static bool message_decode_body(struct message_decoder_context *ctx,
 250                                  struct message_block *input,
 251                                  struct message_block *output)
 252  {
 253          unsigned char new_buf[MAX_ENCODING_BUF_SIZE+1];
 254          const unsigned char *data = NULL;
 255          size_t pos, size = 0, skip = 0;
 256          int ret;
 257   
 258          if (ctx->encoding_size != 0) {
 259                  /* @UNSAFE */
 260                  memcpy(new_buf, ctx->encoding_buf, ctx->encoding_size);
 261                  skip = sizeof(new_buf) - ctx->encoding_size;
 262                  if (skip > input->size)
 263                          skip = input->size;
 264                  memcpy(new_buf + ctx->encoding_size, input->data, skip);
 265          }
 266   
 267          switch (ctx->content_type) {
 268          case CONTENT_TYPE_UNKNOWN:
 269                  /* just skip this body */
 270                  return FALSE;
 271   
 272          case CONTENT_TYPE_BINARY:
 273                  data = input->data;
 274                  size = pos = input->size;
 275                  break;
 276          case CONTENT_TYPE_QP:
 277                  buffer_set_used_size(ctx->buf, 0);
 278
310
Show [ Lines 278 to 310 omitted. ]
 311                  if (ret == 0) {
 312                          /* end of base64 input */
 313                          pos = input->size - skip;
 314                  }
 315                  pos += skip;
 316                  data = ctx->buf->data;
 317                  size = ctx->buf->used;
 318                  break;
 319          }
 320   
 321          if (pos != input->size) {
 322                  /* @UNSAFE */
 323                  i_assert(pos < input->size);
 324                  ctx->encoding_size = input->size - pos;
 325                  i_assert(ctx->encoding_size <= sizeof(ctx->encoding_buf));
 326                  memcpy(ctx->encoding_buf, input->data + pos,
 327                         ctx->encoding_size);
 328          } else {
 329                  ctx->encoding_size = 0;
 330          }
 331   
 332          if (ctx->binary_input) {
 333                  output->data = data;
 334                  output->size = size;
 335          } else if (ctx->charset_utf8) {
 336                  buffer_set_used_size(ctx->buf2, 0);
 337                  if ((ctx->flags & MESSAGE_DECODER_FLAG_DTCASE) != 0) {
 338                          (void)uni_utf8_to_decomposed_titlecase(data, size,
 339                                                                 ctx->buf2);
 340                          output->data = ctx->buf2->data;
 341                          output->size = ctx->buf2->used;
 342                  } else if (uni_utf8_get_valid_data(data, size, ctx->buf2)) {
 343                          output->data = data;
 344                          output->size = size;
 345                  } else {
 346                          output->data = ctx->buf2->data;
 347                          output->size = ctx->buf2->used;
 348                  }
 349          } else if (ctx->charset_trans == NULL) {
 350                  /* unknown charset */
 351                  buffer_set_used_size(ctx->buf2, 0);
 352                  if (uni_utf8_get_valid_data(data, size, ctx->buf2)) {
 353                          output->data = data;
 354                          output->size = size;
 355                  } else {
 356                          output->data = ctx->buf2->data;
 357                          output->size = ctx->buf2->used;
 358                  }
 359          } else {
 360                  buffer_set_used_size(ctx->buf2, 0);
 361                  if (ctx->translation_size != 0)
 362[+]                         translation_buf_decode(ctx, &data, &size);
expand/collapse

translation_buf_decode

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-mail/message-decoder.c)expand/collapse
Show more  
 186  static void translation_buf_decode(struct message_decoder_context *ctx,
 187                                     const unsigned char **data, size_t *size)
 188  {
 189          unsigned char trans_buf[MAX_TRANSLATION_BUF_SIZE+1];
 190          unsigned int data_wanted, skip;
 191          size_t trans_size;
 192   
 193          /* @UNSAFE: move the previously untranslated bytes to trans_buf 
 194             and see if we have now enough data to get the next character
 195             translated */
 196          memcpy(trans_buf, ctx->translation_buf, ctx->translation_size);
 197          data_wanted = sizeof(trans_buf) - ctx->translation_size;
 198          if (data_wanted > *size)
 199                  data_wanted = *size;
 200          memcpy(trans_buf + ctx->translation_size, *data, data_wanted);
Show more  
Show more  




Change Warning 7164.24745 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: