Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140361179
D12503.id33440.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
D12503.id33440.diff
View Options
Index: head/usr.sbin/mountd/mountd.c
===================================================================
--- head/usr.sbin/mountd/mountd.c
+++ head/usr.sbin/mountd/mountd.c
@@ -101,7 +101,7 @@
struct dirlist *dp_right;
int dp_flag;
struct hostlist *dp_hosts; /* List of hosts this dir exported to */
- char dp_dirp[1]; /* Actually malloc'd to size of dir */
+ char *dp_dirp;
};
/* dp_flag bits */
#define DP_DEFSET 0x1
@@ -1525,12 +1525,8 @@
if (ep == (struct exportlist *)NULL) {
ep = get_exp();
ep->ex_fs = fsb.f_fsid;
- ep->ex_fsdir = (char *)malloc
- (strlen(fsb.f_mntonname) + 1);
- if (ep->ex_fsdir)
- strcpy(ep->ex_fsdir,
- fsb.f_mntonname);
- else
+ ep->ex_fsdir = strdup(fsb.f_mntonname);
+ if (ep->ex_fsdir == NULL)
out_of_mem();
if (debug)
warnx(
@@ -1940,14 +1936,16 @@
{
struct dirlist *dp;
- dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len);
+ dp = (struct dirlist *)malloc(sizeof (struct dirlist));
if (dp == (struct dirlist *)NULL)
out_of_mem();
dp->dp_left = *dpp;
dp->dp_right = (struct dirlist *)NULL;
dp->dp_flag = 0;
dp->dp_hosts = (struct hostlist *)NULL;
- strcpy(dp->dp_dirp, cp);
+ dp->dp_dirp = strndup(cp, len);
+ if (dp->dp_dirp == NULL)
+ out_of_mem();
*dpp = dp;
return (dp->dp_dirp);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 24, 1:45 AM (11 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27206055
Default Alt Text
D12503.id33440.diff (1 KB)
Attached To
Mode
D12503: mountd: Convert some malloc+strcpy to strdup
Attached
Detach File
Event Timeline
Log In to Comment