mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
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
1 changed files with 3 additions and 1 deletions
|
|
@ -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 a new issue