mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 10:04:00 +08:00
Fixed a poorly sized string in ntfsinfo
A string overflow was possible, extend its size to worst case.
This commit is contained in:
parent
8e01e1ed65
commit
eddd96f9e6
@ -8,7 +8,7 @@
|
|||||||
* Copyright (c) 2004-2005 Yuval Fledel
|
* Copyright (c) 2004-2005 Yuval Fledel
|
||||||
* Copyright (c) 2004-2007 Yura Pakhuchiy
|
* Copyright (c) 2004-2007 Yura Pakhuchiy
|
||||||
* Copyright (c) 2005 Cristian Klein
|
* Copyright (c) 2005 Cristian Klein
|
||||||
* Copyright (c) 2011-2018 Jean-Pierre Andre
|
* Copyright (c) 2011-2020 Jean-Pierre Andre
|
||||||
*
|
*
|
||||||
* This utility will dump a file's attributes.
|
* This utility will dump a file's attributes.
|
||||||
*
|
*
|
||||||
@ -331,7 +331,7 @@ static char *ntfsinfo_time_to_str(const sle64 sle_ntfs_clock)
|
|||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } ;
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } ;
|
||||||
static const char *wdays[]
|
static const char *wdays[]
|
||||||
= { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } ;
|
= { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } ;
|
||||||
static char str[30];
|
static char str[50];
|
||||||
long long stamp;
|
long long stamp;
|
||||||
u32 days;
|
u32 days;
|
||||||
u32 seconds;
|
u32 seconds;
|
||||||
@ -371,7 +371,7 @@ static char *ntfsinfo_time_to_str(const sle64 sle_ntfs_clock)
|
|||||||
mon = days/31 + 1;
|
mon = days/31 + 1;
|
||||||
days -= 31*(mon - 1) - 1;
|
days -= 31*(mon - 1) - 1;
|
||||||
}
|
}
|
||||||
sprintf(str,"%3s %3s %2u %02u:%02u:%02u %4u UTC\n",
|
snprintf(str, sizeof(str), "%3s %3s %2u %02u:%02u:%02u %4u UTC\n",
|
||||||
wdays[wday],
|
wdays[wday],
|
||||||
months[mon-1],(unsigned int)days,
|
months[mon-1],(unsigned int)days,
|
||||||
(unsigned int)(seconds/3600),
|
(unsigned int)(seconds/3600),
|
||||||
|
Loading…
Reference in New Issue
Block a user