aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTim Vanderhoek <hoek@FreeBSD.org>1999-06-21 16:23:13 +0000
committerTim Vanderhoek <hoek@FreeBSD.org>1999-06-21 16:23:13 +0000
commit8630d8cfc6c08fc0583f2f9f0d26c597c4bf6326 (patch)
tree910c0d940c6edfc181b1e08fef733296e1e765f0 /sys
parent35cd460f8abe28608b9fb5fca6f0a1a9e3e136f2 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/imgact_gzip.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/kern/imgact_gzip.c b/sys/kern/imgact_gzip.c
index 0c410f30bac8..09e52f17b265 100644
--- a/sys/kern/imgact_gzip.c
+++ b/sys/kern/imgact_gzip.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: imgact_gzip.c,v 1.36 1999/01/29 22:59:43 dillon Exp $
+ * $Id: imgact_gzip.c,v 1.37 1999/05/09 16:04:09 peter Exp $
*
* This module handles execution of a.out files which have been run through
* "gzip". This saves diskspace, but wastes cpu-cycles and VM.
@@ -47,6 +47,7 @@ struct imgact_gzip {
struct image_params *ip;
struct exec a_out;
int error;
+ int gotheader;
int where;
u_char *inbuf;
u_long offset;
@@ -115,6 +116,13 @@ exec_gzip_imgact(imgp)
error = inflate(&infl);
+ /*
+ * The unzipped file may not even have been long enough to contain
+ * a header giving Flush() a chance to return error. Check for this.
+ */
+ if ( !igz.gotheader )
+ return ENOEXEC;
+
if ( !error ) {
vmspace = imgp->proc->p_vmspace;
error = vm_map_protect(&vmspace->vm_map,
@@ -329,6 +337,7 @@ Flush(void *vp, u_char * ptr, u_long siz)
p += i;
siz -= i;
if (gz->output == sizeof gz->a_out) {
+ gz->gotheader = 1;
i = do_aout_hdr(gz);
if (i == -1) {
if (!gz->where)