<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ubus/lua, branch master</title>
<subtitle>OpenWrt system message/RPC bus</subtitle>
<id>https://git.openwrt.org/project/ubus/atom?h=master</id>
<link rel='self' href='https://git.openwrt.org/project/ubus/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/'/>
<updated>2026-05-23T00:47:34Z</updated>
<entry>
<title>lua: fix unchecked calloc and memory leak in ubus_lua_load_object</title>
<updated>2026-05-23T00:47:34Z</updated>
<author>
<name>Hauke Mehrtens</name>
</author>
<published>2026-04-12T22:11:26Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=43051ca73aec19c53d20e17e0e37a8ebd7d52d56'/>
<id>urn:sha1:43051ca73aec19c53d20e17e0e37a8ebd7d52d56</id>
<content type='text'>
Two bugs in the method array allocation:

1. calloc(mlen, sizeof(struct ubus_method)) was not checked for NULL.
   On OOM the returned NULL pointer was stored in obj-&gt;o.methods and
   later dereferenced as m[midx], causing a crash.

2. calloc(0, N) has implementation-defined behaviour (may return NULL
   or a unique pointer). Treat mlen == 0 explicitly by setting m = NULL
   and skipping the allocation.

3. When the subsequent calloc for obj-&gt;o.type failed, the already-
   allocated method array 'm' was not freed, causing a memory leak.

Co-Authored-By: Claude Sonnet 4.6 &lt;noreply@anthropic.com&gt;
Link: https://github.com/openwrt/ubus/pull/20
Signed-off-by: Hauke Mehrtens &lt;hauke@hauke-m.de&gt;
</content>
</entry>
<entry>
<title>lua: fix inverted argument check in ubus_lua_add</title>
<updated>2026-05-23T00:47:29Z</updated>
<author>
<name>Hauke Mehrtens</name>
</author>
<published>2026-04-12T22:10:57Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=3ab9d77595457f56ed1f26350ce15d308e50f09f'/>
<id>urn:sha1:3ab9d77595457f56ed1f26350ce15d308e50f09f</id>
<content type='text'>
The guard 'if (lua_istable(L, 1))' was backwards: it raised an error
when argument 1 IS a table, but argument 1 is always the ubus_context
userdata (never a table). The intent was to reject calls where argument
2 is NOT a table.

As a result, any call to ubus.add(c, non_table) silently proceeded to
lua_next() on a non-table value, causing a crash, while a valid call
with a proper table as argument 2 was never incorrectly rejected only
because arg 1 never matches lua_istable.

Fix by checking !lua_istable(L, 2).

Co-Authored-By: Claude Sonnet 4.6 &lt;noreply@anthropic.com&gt;
Link: https://github.com/openwrt/ubus/pull/20
Signed-off-by: Hauke Mehrtens &lt;hauke@hauke-m.de&gt;
</content>
</entry>
<entry>
<title>lua: CMakeLists: drop redundant cmake_minimum_required</title>
<updated>2025-10-07T12:19:11Z</updated>
<author>
<name>David Härdeman</name>
</author>
<published>2025-10-05T15:41:31Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=b462895d3157c0f2a87fb4a0341eead4202ce272'/>
<id>urn:sha1:b462895d3157c0f2a87fb4a0341eead4202ce272</id>
<content type='text'>
The Lua module depends on the parent ubus project and can't be built
independently.

Drop redundant cmake_minimum_required from lua/CMakeLists.txt and
inherit the version from the parent CMake project to keep version
consistency.

Signed-off-by: David Härdeman &lt;david@hardeman.nu&gt;
Link: https://github.com/openwrt/ubus/pull/7
Signed-off-by: Christian Marangi &lt;ansuelsmth@gmail.com&gt;
</content>
</entry>
<entry>
<title>lua: build: require CMake &gt;= 3.10 due to dropped legacy support</title>
<updated>2025-10-04T10:12:15Z</updated>
<author>
<name>Hauke Mehrtens</name>
</author>
<published>2025-10-03T17:49:29Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=ad2768bbc166b4dcb32665d7b3434d54150b2abc'/>
<id>urn:sha1:ad2768bbc166b4dcb32665d7b3434d54150b2abc</id>
<content type='text'>
CMake version 4.0 and later require minimum version of 3.5 or later.
Update to minimum version 3.10 which is the last not deprecated minimum
version.

CMake 3.10 was released in November 2017 and is included in Ubuntu 18.04.

Suggested-by: Hannu Nyman &lt;hannu.nyman@iki.fi&gt;
Signed-off-by: Hauke Mehrtens &lt;hauke@hauke-m.de&gt;
</content>
</entry>
<entry>
<title>lua: add optional path filter to objects() method</title>
<updated>2022-05-30T05:00:52Z</updated>
<author>
<name>Etienne Champetier</name>
</author>
<published>2022-05-01T21:58:09Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=2f793a4eb063128d80fc46ada243d2aad47fd1fe'/>
<id>urn:sha1:2f793a4eb063128d80fc46ada243d2aad47fd1fe</id>
<content type='text'>
'ubus list [&lt;path&gt;]' passes the path to ubusd,
this commit fix the lua bindings to do the same

Signed-off-by: Etienne Champetier &lt;champetier.etienne@gmail.com&gt;
</content>
</entry>
<entry>
<title>lua: avoid truncation of large numeric values</title>
<updated>2020-03-15T19:49:27Z</updated>
<author>
<name>Alin Nastac</name>
</author>
<published>2020-02-03T12:58:04Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=171469e3138cce191892e20b6fd35b52c9368064'/>
<id>urn:sha1:171469e3138cce191892e20b6fd35b52c9368064</id>
<content type='text'>
If the Lua number exceeds the maximum value representable by an
unsigned 32bit integer, store it in an unsigned 64bit integer
field instead.

Signed-off-by: Alin Nastac &lt;alin.nastac@gmail.com&gt;
[align code style, reword commit message]
Signed-off-by: Jo-Philipp Wich &lt;jo@mein.io&gt;
</content>
</entry>
<entry>
<title>lua: ubus_lua_do_subscribe: fix copy&amp;paste error</title>
<updated>2019-12-16T22:39:16Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2019-12-16T22:02:02Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=72be8e93f07d0dfb1f42edfbdb93ea04311dcb5a'/>
<id>urn:sha1:72be8e93f07d0dfb1f42edfbdb93ea04311dcb5a</id>
<content type='text'>
Fix copy&amp;paste error in Lua ubus subscriber removal callback.

Addresses-Coverity-ID: 1412311 ("Copy-paste error")
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>lua: workaround false positive dereference of null pointer</title>
<updated>2019-12-16T22:39:16Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2019-12-16T20:52:55Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=a995b1e68129a0bb3928625c4f5a7bcb24893d75'/>
<id>urn:sha1:a995b1e68129a0bb3928625c4f5a7bcb24893d75</id>
<content type='text'>
scan-build from clang-9 has reported following:

 ubus.c:837:16: warning: Access to field 'rnotify' results in a dereference of a null pointer (loaded from variable 'sub')
                 sub-&gt;rnotify = luaL_ref(L, -2);

Which is false positive as the lua_error() does a long jump and
therefore never returns and this long jump probably confuses the static
analyzer. So this patch workarounds this false positive by helping
static analyzer by using common Lua idiom which is to return
lua_error()'s return value.

Ref: https://www.lua.org/manual/5.1/manual.html#lua_error
Addresses-Coverity-ID: 1412355 ("Dereference after null check")
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>iron out all extra compiler warnings</title>
<updated>2019-12-16T22:39:16Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2019-12-11T09:36:36Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=d2e026a33df81f116ceb2567056346f38d139706'/>
<id>urn:sha1:d2e026a33df81f116ceb2567056346f38d139706</id>
<content type='text'>
clang-9 on x86/64 has reported following warnings/errors:

 libubus-acl.c:123:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 libubus-io.c:108:18: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
 libubus-io.c:395:56: error: comparison of integers of different signs: 'ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
 libubus-req.c:441:4: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:119:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd_acl.c:152:5: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:348:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:352:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:357:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:362:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:367:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:447:16: error: comparison of integers of different signs: 'int' and '__size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
 ubusd_acl.c:502:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:123:13: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:170:15: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:262:43: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:287:30: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd_event.c:170:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd_obj.c:71:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]

Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>ubus/lua: add support for BLOBMSG_TYPE_DOUBLE</title>
<updated>2018-09-10T07:48:17Z</updated>
<author>
<name>Marcus Comstedt</name>
</author>
<published>2018-08-21T10:43:06Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/ubus/commit/?id=0327a91bebad00fc9a1132bc9b012c185444197c'/>
<id>urn:sha1:0327a91bebad00fc9a1132bc9b012c185444197c</id>
<content type='text'>
Signed-off-by: Marcus Comstedt &lt;marcus@mc.pp.se&gt;
</content>
</entry>
</feed>
