[OpenWrt-Devel] [PATCH 1/1] libubox: add format string checking to ulog()

Kristupas Savickas savickas.kristupas at gmail.com
Mon Jun 10 05:51:09 EDT 2019


Hi,

sorry about that, fixed.

From 4464f0ec27aa6c2c96b55d37a5eab090325621c9 Mon Sep 17 00:00:00 2001
From: Kristupas Savickas <kristupas.savickas at gmail.com
Date: Mon, 10 Jun 2019 12:36:50 +0300
Subject: [PATCH] libubox: add format string checking to ulog()
To: ynezz at true.cz
Cc: openwrt-devel at lists.openwrt.org

This offers an increased level of security, as the arguments will be
checked for validity against the format string at compile time. The
format attribute is supported by both GCC and Clang, so there shouldn't
be any portability issues.

Signed-off-by: Kristupas Savickas <kristupas.savickas at gmail.com>
---
 ulog.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ulog.h b/ulog.h
index 4818b1a..85702ec 100644
--- a/ulog.h
+++ b/ulog.h
@@ -32,7 +32,8 @@ void ulog_close(void);

 void ulog_threshold(int threshold);

-void ulog(int priority, const char *fmt, ...);
+void ulog(int priority, const char *fmt, ...)
+       __attribute__ ((format (printf, 2, 3)));

 #define ULOG_INFO(fmt, ...) ulog(LOG_INFO, fmt, ## __VA_ARGS__)
 #define ULOG_NOTE(fmt, ...) ulog(LOG_NOTICE, fmt, ## __VA_ARGS__)
-- 
2.21.0

On Mon, Jun 10, 2019 at 9:52 AM Petr Štetiar <ynezz at true.cz> wrote:
>
> Kristupas Savickas <savickas.kristupas at gmail.com> [2019-06-06 21:43:23]:
>
> Hi,
>
> > From b659ea5fc6511f9f58f04ca4eb58698aa8386f11 Mon Sep 17 00:00:00 2001
> > From: Kristupas Savickas <savickas.kristupas at gmail.com>
> > Date: Thu, 6 Jun 2019 21:28:32 +0300
> > Subject: [PATCH 1/1] libubox: add format string checking to ulog()
> > To: openwrt-devel at lists.openwrt.org
> >
> > This offers an increased level of security, as the arguments will be
> > checked for validity against the format string at compile time. The
> > format attribute is supported by both GCC and Clang, so there shouldn't
> > be any portability issues.
>
> Applying: libubox: add format string checking to ulog()
> fatal: corrupt patch at line 14
> Patch failed at 0001 libubox: add format string checking to ulog()
>
> -- ynezz

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


More information about the openwrt-devel mailing list