mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
msvcrt: Avoid a NULL pointer deref in ctime.
This commit is contained in:
parent
b77f0a1672
commit
82f77cc17a
@ -31,6 +31,13 @@
|
||||
#define MINSPERHOUR 60
|
||||
#define HOURSPERDAY 24
|
||||
|
||||
static void test_ctime(void)
|
||||
{
|
||||
time_t badtime = -1;
|
||||
char* ret;
|
||||
ret = ctime(&badtime);
|
||||
ok(ret == NULL, "expected ctime to return NULL, got %s\n", ret);
|
||||
}
|
||||
static void test_gmtime(void)
|
||||
{
|
||||
time_t gmt = (time_t)NULL;
|
||||
@ -249,6 +256,7 @@ static void test_wstrtime(void)
|
||||
|
||||
START_TEST(time)
|
||||
{
|
||||
test_ctime();
|
||||
test_gmtime();
|
||||
test_mktime();
|
||||
test_localtime();
|
||||
|
@ -447,7 +447,10 @@ MSVCRT_wchar_t * CDECL MSVCRT__wasctime(const struct MSVCRT_tm *mstm)
|
||||
*/
|
||||
char * CDECL MSVCRT_ctime(const MSVCRT_time_t *time)
|
||||
{
|
||||
return MSVCRT_asctime( MSVCRT_localtime(time) );
|
||||
struct MSVCRT_tm *t;
|
||||
t = MSVCRT_localtime( time );
|
||||
if (!t) return NULL;
|
||||
return MSVCRT_asctime( t );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user