[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#472269: libc6: res_query makes assumptions about the alignment of the answer argument



Package: libc6
Version: 2.7-9
Severity: normal

Hi,

  libc6 assumes the answer argument to the res_query function which is of
  type unsigned char * is aligned in such a way it can be cast to HEADER.

  Thus following apparently correct code causes a SIGBUS on sparc:
     #include <stdio.h>

     #include <arpa/nameser.h>
     #include <resolv.h>

     int
     main (int argc, char ** argv) {
       unsigned char padding[3];
       unsigned char answer[1024];

       res_query ("_xmpp-client._tcp.gmail.com", C_IN, T_SRV,
         answer, sizeof(answer));
       return 0;
     }

  Which is obviously quite nasty.

  Sjoerd

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

Kernel: Linux 2.6.24-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=nl_NL (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6 depends on:
ii  libgcc1                       1:4.3.0-1  GCC support library

libc6 recommends no packages.

-- debconf information:
  glibc/upgrade: true
  glibc/restart-failed:
  glibc/restart-services:



Reply to: