shithub: orca

Download patch

ref: 5b152a57c84de9861fd82121c547193fdd34a588
parent: 2f27233e19a1d205ca6bf94542c7fa8d922cfaa2
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 17 16:07:10 EST 2020

plan9: check file type before loading

--- a/plan9.c
+++ b/plan9.c
@@ -511,7 +511,14 @@
 static int
 fieldload(char *path)
 {
+	Dir *d;
 	Field_load_error e;
+
+	if ((d = dirstat(path)) == nil || d->length < 1 || (d->type & DMDIR) != 0) {
+		free(d);
+		werrstr("invalid orca file");
+		return -1;
+	}
 
 	if ((e = field_load_file(path, &field)) != Field_load_error_ok) {
 		werrstr(field_load_error_string(e));