diff options
author | Karel Zak | 2006-12-07 00:25:35 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:35 +0100 |
commit | 2b6fc908bc368b540845a313c3b8a867c5ad9a42 (patch) | |
tree | 6fad48a239bc90515a5dc4084d6e3c3ee1f41e29 /mount/umount.c | |
parent | Imported from util-linux-2.7.1 tarball. (diff) | |
download | kernel-qcow2-util-linux-2b6fc908bc368b540845a313c3b8a867c5ad9a42.tar.gz kernel-qcow2-util-linux-2b6fc908bc368b540845a313c3b8a867c5ad9a42.tar.xz kernel-qcow2-util-linux-2b6fc908bc368b540845a313c3b8a867c5ad9a42.zip |
Imported from util-linux-2.8 tarball.
Diffstat (limited to 'mount/umount.c')
-rw-r--r-- | mount/umount.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mount/umount.c b/mount/umount.c index de80fd1bc..6f28213b4 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -100,13 +100,18 @@ nfs_umount_rpc_call(const char *spec, const char *opts) if (hostname[0] >= '0' && hostname[0] <= '9') saddr.sin_addr.s_addr = inet_addr(hostname); - else + else { if ((hostp = gethostbyname(hostname)) == NULL) { - fprintf(stderr, "mount: can't get address for %s\n", + fprintf(stderr, "umount: can't get address for %s\n", hostname); return 1; - } else - memcpy(&saddr.sin_addr, hostp->h_addr, hostp->h_length); + } + if (hostp->h_length > sizeof(struct in_addr)) { + fprintf(stderr, "umount: got bad hostp->h_length\n"); + hostp->h_length = sizeof(struct in_addr); + } + memcpy(&saddr.sin_addr, hostp->h_addr, hostp->h_length); + } saddr.sin_family = AF_INET; saddr.sin_port = 0; |