summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--linux-user/gen-vdso.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/linux-user/gen-vdso.c b/linux-user/gen-vdso.c
index 1c406d1b10..aeaa927db8 100644
--- a/linux-user/gen-vdso.c
+++ b/linux-user/gen-vdso.c
@@ -124,6 +124,11 @@ int main(int argc, char **argv)
         goto perror_inf;
     }
 
+    if (total_len < EI_NIDENT) {
+        fprintf(stderr, "%s: file too small (truncated?)\n", inf_name);
+        return EXIT_FAILURE;
+    }
+
     buf = malloc(total_len);
     if (buf == NULL) {
         goto perror_inf;