diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-27 19:38:19 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-27 19:38:19 +0100 |
commit | 99069330a104e6d360635174be5f5ed054c418b8 (patch) | |
tree | f800b70a7b8989db14f5964b65534181d4a1a309 /util-linux | |
parent | ca228fb16dddc3c959adad97a930612a6b5256db (diff) | |
download | busybox-99069330a104e6d360635174be5f5ed054c418b8.tar.gz |
*: gethostname-related fixes
function old new delta
hostname_main 218 231 +13
nfsmount 3541 3474 -67
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/mount.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 4392363ba..620b14667 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -1043,12 +1043,10 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) bb_herror_msg("%s", hostname); goto fail; } - if ((size_t)hp->h_length > sizeof(struct in_addr)) { - bb_error_msg("got bad hp->h_length"); - hp->h_length = sizeof(struct in_addr); + if (hp->h_length != (int)sizeof(struct in_addr)) { + bb_error_msg_and_die("only IPv4 is supported"); } - memcpy(&server_addr.sin_addr, - hp->h_addr, hp->h_length); + memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr)); } memcpy(&mount_server_addr, &server_addr, sizeof(mount_server_addr)); @@ -1331,13 +1329,11 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) bb_herror_msg("%s", mounthost); goto fail; } - if ((size_t)hp->h_length > sizeof(struct in_addr)) { - bb_error_msg("got bad hp->h_length"); - hp->h_length = sizeof(struct in_addr); + if (hp->h_length != (int)sizeof(struct in_addr)) { + bb_error_msg_and_die("only IPv4 is supported"); } mount_server_addr.sin_family = AF_INET; - memcpy(&mount_server_addr.sin_addr, - hp->h_addr, hp->h_length); + memcpy(&mount_server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr)); } } |