commit e1b1c71e9f235229621151fe3d8ff10b39dc6966
parent cab6cf02606b5f3a8d6ffa2f084cb12da96d6fcd
Author: Pollux <pollux@pollux.codes>
Date: Fri, 21 Feb 2025 00:16:13 -0600
fix: Segmentation fault on no arguments
Signed-off-by: Pollux <pollux@pollux.codes>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/sopen.c b/sopen.c
@@ -124,6 +124,11 @@ main(int argc, char *const *argv) {
char *child_args[3];
+ if(argc < 2) {
+ print_help();
+ exit(0);
+ }
+
cookie = magic_open(MAGIC_MIME_TYPE);
if(cookie == NULL) {
printf("Failed to open magic cookie.\n");