Public bug reported:
strftime will cause segmentation fault when passed 0 or NULL as last parameter
(struct tm *tm).
Tested on dapper and gutsy with following:
- test.c -
// gcc -Wall test.c -o strftime.test && ./strftime.test
#include <stdio.h>
#include <time.h>
int main(void) {
char temp[80] = "";
printf("formatting\n");
strftime(temp, 80, "Now is %c", NULL);
printf("done\n");
printf(temp);
return 0;
}
- -
Output:
- -
formatting
Segmentation fault (core dumped)
- -
The competing (Visual Studio 2005) implementation will fail an assertion on
this, but will continue execution with "Now is " -string in temp.
Also, glib will segfault even without any % -directives in formatting string.
** Affects: glibc (Ubuntu)
Importance: Undecided
Status: New
--
strftime(3) segfaults when passed NULL as tm
https://bugs.launchpad.net/bugs/162850
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs