[OpenWrt-Devel] [PATCH 4/4] blobmsg_add_json_from_file(): fixed const-correctness with libjson

Bachtin, Dmitri dbachtin at init-ka.de
Wed Sep 9 05:30:00 EDT 2015

> I think the non-const parameter of json_object_from_file is a bug, and in that case, a cast is better than a completely unnecessary strdup().
> - Felix

I've checked the source of json_object_from_file(char*) and the buffer walks directly into open(3) and vsyslog(3). open(3) takes a const buffer while vsyslog(3) takes a varargs list which doesn't tinker with the buffer, too.

You are completely right, Felix, and a cast is enough.
 -- Dmitri Bachtin
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list