bug-glibc
[Top][All Lists]
Advanced

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

possible bug in snprintf()


From: Ryan Ordway
Subject: possible bug in snprintf()
Date: Wed, 25 Aug 2004 15:28:46 -0700

        I'm having an issue with snprintf()
mishandling embedded % characters in the
source string. For example:


#include <stdio.h>

int main(int argc, char argv[])
{
   char string[512];
   snprintf(string, sizeof(string), "Gain the 100% natural");
   printf("%s\n", string);
   return 0;
}

address@hidden src]$ gcc test.c
address@hidden src]$ ./a.out
Segmentation fault


        I have an application that does handling
of e-mail data, and a spam message containing
the above string in the Subject: header keeps
causing it to die. Is this a problem with snprintf(),
or do I need to pre-process the input strings and
replace the % characters?

        Thanks,

        Ryan



-- 
HELO, my name is root... you have SIGKILLed my father... prepare to vi!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]