Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170989399
D32615.id97338.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.id97338.diff
View Options
Index: sbin/route/route.c
===================================================================
--- sbin/route/route.c
+++ sbin/route/route.c
@@ -101,8 +101,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 int rtm_seq;
static char rt_line[NI_MAXHOST];
static char net_line[MAXHOSTNAMELEN + 1];
@@ -533,14 +533,14 @@
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, MAXHOSTNAMELEN) == 0 &&
+ (cp = strchr(domain_storage, '.')) != NULL) {
+ 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
Wed, Sep 9, 1:14 AM (7 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38552066
Default Alt Text
D32615.id97338.diff (1 KB)
Attached To
Mode
D32615: route: avoid overlapping strcpy
Attached
Detach File
Event Timeline
Log In to Comment