projects
/
debian
/
tar
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.23
[debian/tar]
/
lib
/
rtapelib.c
diff --git
a/lib/rtapelib.c
b/lib/rtapelib.c
index 51faf3ce91dbd50496705ff15338e87d58c39466..cb645db5d9a4156200d5350367c0fa95322b7c81 100644
(file)
--- a/
lib/rtapelib.c
+++ b/
lib/rtapelib.c
@@
-425,7
+425,10
@@
rmt_open__ (const char *file_name, int open_mode, int bias,
}
/* FIXME: Should somewhat validate the decoding, here. */
}
/* FIXME: Should somewhat validate the decoding, here. */
-
+ if (gethostbyname (remote_host) == NULL)
+ error (EXIT_ON_EXEC_ERROR, 0, _("Cannot connect to %s: resolve failed"),
+ remote_host);
+
if (remote_user && *remote_user == '\0')
remote_user = 0;
if (remote_user && *remote_user == '\0')
remote_user = 0;
@@
-570,7
+573,8
@@
rmt_read__ (int handle, char *buffer, size_t length)
sprintf (command_buffer, "R%lu\n", (unsigned long) length);
if (do_command (handle, command_buffer) == -1
sprintf (command_buffer, "R%lu\n", (unsigned long) length);
if (do_command (handle, command_buffer) == -1
- || (status = get_status (handle)) == SAFE_READ_ERROR)
+ || (status = get_status (handle)) == SAFE_READ_ERROR
+ || status > length)
return SAFE_READ_ERROR;
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
return SAFE_READ_ERROR;
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
@@
-706,6
+710,12
@@
rmt_ioctl__ (int handle, int operation, char *argument)
|| (status = get_status (handle), status == -1))
return -1;
|| (status = get_status (handle), status == -1))
return -1;
+ if (status > sizeof (struct mtop))
+ {
+ errno = EOVERFLOW;
+ return -1;
+ }
+
for (; status > 0; status -= counter, argument += counter)
{
counter = safe_read (READ_SIDE (handle), argument, status);
for (; status > 0; status -= counter, argument += counter)
{
counter = safe_read (READ_SIDE (handle), argument, status);