Quellcode durchsuchen

libdpkg: Make run_error_handler cope with NULL econtext gracefully

This could happen if the context has not been initialized, or if it has
been unwinded more than necessary.
Guillem Jover vor 16 Jahren
Ursprung
Commit
43789e59f0
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 6 0
      lib/dpkg/ehandle.c

+ 6 - 0
lib/dpkg/ehandle.c

@@ -97,6 +97,12 @@ run_error_handler(void)
     fprintf(stderr, _("%s: unrecoverable fatal error, aborting:\n %s\n"),
     fprintf(stderr, _("%s: unrecoverable fatal error, aborting:\n %s\n"),
             thisname, errmsg);
             thisname, errmsg);
     exit(2);
     exit(2);
+  }
+
+  if (econtext == NULL) {
+    fprintf(stderr, _("%s: outside error context, aborting:\n %s\n"),
+            thisname, errmsg);
+    exit(2);
   } else {
   } else {
     longjmp(*econtext->jump, 1);
     longjmp(*econtext->jump, 1);
   }
   }