Avoid buffer overflow or truncation when constructing path_zoneinfo_file.
Reported by: Coverity CID: 1011160 MFC after: 1 week
This commit is contained in:
parent
243e928310
commit
ee67f7cc77
@ -838,7 +838,9 @@ install_zoneinfo(const char *zoneinfo)
|
||||
FILE *f;
|
||||
char path_zoneinfo_file[MAXPATHLEN];
|
||||
|
||||
sprintf(path_zoneinfo_file, "%s/%s", path_zoneinfo, zoneinfo);
|
||||
if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file),
|
||||
"%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file))
|
||||
errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo);
|
||||
rv = install_zoneinfo_file(path_zoneinfo_file);
|
||||
|
||||
/* Save knowledge for later */
|
||||
|
Loading…
Reference in New Issue
Block a user