Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150741808
D32615.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
D32615.diff
View Options
diff --git a/sbin/route/route.c b/sbin/route/route.c
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -94,8 +94,8 @@
static uid_t uid;
static int defaultfib;
static int numfibs;
-static char domain[MAXHOSTNAMELEN + 1];
-static bool domain_initialized;
+static char domain_storage[MAXHOSTNAMELEN + 1];
+static const char *domain;
static char rt_line[NI_MAXHOST];
static char net_line[MAXHOSTNAMELEN + 1];
@@ -581,14 +581,16 @@
const char *cp;
int n;
- if (!domain_initialized) {
- domain_initialized = true;
- if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = strchr(domain, '.'))) {
- domain[MAXHOSTNAMELEN] = '\0';
- (void)strcpy(domain, cp + 1);
- } else
- domain[0] = '\0';
+ if (domain == NULL) {
+ if (gethostname(domain_storage,
+ sizeof(domain_storage) - 1) == 0 &&
+ (cp = strchr(domain_storage, '.')) != NULL) {
+ domain_storage[sizeof(domain_storage) - 1] = '\0';
+ domain = cp + 1;
+ } else {
+ domain_storage[0] = '\0';
+ domain = domain_storage;
+ }
}
/* If the address is zero-filled, use "default". */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 6:28 PM (12 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30834169
Default Alt Text
D32615.diff (1 KB)
Attached To
Mode
D32615: route: avoid overlapping strcpy
Attached
Detach File
Event Timeline
Log In to Comment