Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144537646
D16595.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D16595.diff
View Options
Index: head/usr.sbin/tzsetup/tzsetup.c
===================================================================
--- head/usr.sbin/tzsetup/tzsetup.c
+++ head/usr.sbin/tzsetup/tzsetup.c
@@ -481,7 +481,7 @@
char contbuf[16];
FILE *fp;
struct continent *cont;
- size_t len;
+ size_t len, contlen;
char *line, *tlc, *file, *descr, *p;
int lineno;
@@ -504,12 +504,16 @@
path_zonetab, lineno, tlc);
/* coord = */ strsep(&line, "\t"); /* Unused */
file = strsep(&line, "\t");
+ /* get continent portion from continent/country */
p = strchr(file, '/');
if (p == NULL)
errx(1, "%s:%d: invalid zone name `%s'", path_zonetab,
lineno, file);
- contbuf[0] = '\0';
- strncat(contbuf, file, p - file);
+ contlen = p - file + 1; /* trailing nul */
+ if (contlen > sizeof(contbuf))
+ errx(1, "%s:%d: continent name in zone name `%s' too long",
+ path_zonetab, lineno, file);
+ strlcpy(contbuf, file, contlen);
cont = find_continent(contbuf);
if (!cont)
errx(1, "%s:%d: invalid region `%s'", path_zonetab,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 10, 8:08 AM (17 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28618253
Default Alt Text
D16595.diff (1 KB)
Attached To
Mode
D16595: Always terminate string with nul.
Attached
Detach File
Event Timeline
Log In to Comment