In 22.03, px5-mbedtls isn't bothering to check if the output was opened:

--- a/package/utils/px5g-mbedtls/px5g-mbedtls.c
+++ b/package/utils/px5g-mbedtls/px5g-mbedtls.c
@@ -29,6 +29,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdbool.h>
+#include <errno.h>

 #include <mbedtls/bignum.h>
 #include <mbedtls/x509_crt.h>
@@ -70,6 +71,11 @@ static void write_file(const char *path, int len, bool pem)
        if (path)
                f = fopen(path, "w");

+    if (!f) {
+ fprintf(stderr, "Failed to open output '%s': %s\n", path, strerror(errno));
+               exit(1);
+    }
+
        fwrite(buf_start, 1, len, f);
        fclose(f);
 }



_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to