Package: libgmime-2.0-2
Version: 2.2.10-2
Severity: serious
Tags: security

Hi,

on messages with malformed encoding of header values,
g_mime_parser_construct_message does not return.

This could be quite a bad deal as any application processing mail from
untrusted sources (i.e. almost anything working on inbound mail) can be
prevented to process other messages correctly (as in DOS). If, however,
the security team concludes that this bug is not security relevant,
please do remove the tag and lower the severity.

Please find attached testcase.c and testcase.mbox.
Upon compiling with
  gcc $(gmime-config --cflags --libs) testcase.c -o testcase
and running
  ./testcase testcase.mbox
reproduces the problem, which seems to rest with the nothing between the
first two ?? in the subject's "=??Q??=".

Kind regards

T.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-tv0 (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libgmime-2.0-2 depends on:
ii  libc6                   2.7-1            GNU C Library: Shared
ii  libglib2.0-0            2.14.3-1         The GLib library of C
ii  zlib1g                  1:1.2.3.3.dfsg-7 compression library -

libgmime-2.0-2 recommends no packages.

-- no debconf information
-- 
Thomas Viehmann, http://thomas.viehmann.net/
#include <fcntl.h>
#include <stdlib.h>
#include <gmime/gmime.h>

int main(int argc, char** argv)
{
  GMimeStream *stream;
  GMimeParser *parser;
  GMimeMessage *msg = 0;

  int fh;
  
  if (argc != 2) {
    fprintf(stderr, "usage: %s mbox\n",argv[0]);
    exit(1);
  }
   
  g_mime_init(GMIME_INIT_FLAG_UTF8);

  fh = open(argv[1], O_RDONLY);
  if (fh < 0) {
    fprintf(stderr, "could not open\n");
    exit(1);
  }
  
  stream = g_mime_stream_fs_new(fh);
  parser = g_mime_parser_new_with_stream(stream);
  g_mime_parser_set_scan_from(parser, TRUE);
  while (! g_mime_parser_eos(parser)) {
    printf("reading message...\n");  
    msg = g_mime_parser_construct_message(parser);
    printf("read message.\n");
    if (msg != 0) {
      const char* raw_msgid = g_mime_message_get_header(msg, "Message-Id");
      if (raw_msgid != NULL)
        printf("message-id: %s\n",raw_msgid);
      g_object_unref(msg);
    }
  }
  g_mime_stream_unref(stream);
  close(fh);
}
>From [EMAIL PROTECTED]  Thu Dec 06 00:00:00 2007
Subject: =??Q??=
Message-ID: <test>

abc


Reply via email to