<feed xmlns='http://www.w3.org/2005/Atom'>
<title>uci/tests/cram, branch master</title>
<subtitle>OpenWrt Unified Configuration Interface</subtitle>
<id>https://git.openwrt.org/project/uci/atom?h=master</id>
<link rel='self' href='https://git.openwrt.org/project/uci/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/'/>
<updated>2025-11-14T09:00:06Z</updated>
<entry>
<title>github: ci: add tests</title>
<updated>2025-11-14T09:00:06Z</updated>
<author>
<name>Álvaro Fernández Rojas</name>
</author>
<published>2025-11-14T07:50:58Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/commit/?id=e1ab90c510ce89228488607b9f8f383c21f9adc6'/>
<id>urn:sha1:e1ab90c510ce89228488607b9f8f383c21f9adc6</id>
<content type='text'>
Build ubus with UNIT_TESTING and execute tests.

Signed-off-by: Álvaro Fernández Rojas &lt;noltari@gmail.com&gt;
</content>
</entry>
<entry>
<title>file: Check buffer size after strtok()</title>
<updated>2020-10-06T06:33:57Z</updated>
<author>
<name>Hauke Mehrtens</name>
</author>
<published>2020-10-04T15:14:49Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/commit/?id=eae126f66663e5c73e5d290b8e3134449489340f'/>
<id>urn:sha1:eae126f66663e5c73e5d290b8e3134449489340f</id>
<content type='text'>
This fixes a heap overflow in the parsing of the uci line.

The line which is parsed and put into pctx-&gt;buf is null terminated and
stored on the heap. In the uci_parse_line() function we use strtok() to
split this string in multiple parts after divided by a space or tab.
strtok() replaces these characters with a NULL byte. If the next byte is
NULL we assume that this NULL byte was added by strtok() and try to
parse the string after this NULL byte. If this NULL byte was not added
by strtok(), but by fgets() to mark the end of the string we would read
over this end of the string in uninitialized memory and later over the
allocated buffer.

Fix this problem by storing how long the line we read was and check if
we would read over the end of the string here.

This also adds the input which detected this crash to the corpus of the
fuzzer.

Signed-off-by: Hauke Mehrtens &lt;hauke@hauke-m.de&gt;
[fixed merge conflict in tests]
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>tests: cram: add uci import testing on fuzzer corpus</title>
<updated>2020-10-03T07:46:18Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2020-10-03T07:18:17Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/commit/?id=ea5bbd57d0e1f3ff5fd3b8580741c46093caa845'/>
<id>urn:sha1:ea5bbd57d0e1f3ff5fd3b8580741c46093caa845</id>
<content type='text'>
Use valgrind and uci cli compiled with undefined, address and leak
sanitizers.

Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>tests: cram: Lua: add test case for uci_get_errorstr</title>
<updated>2019-12-07T22:40:02Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2019-12-07T22:36:51Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/commit/?id=750b046eb77f04f82389a8af089a4945ca2d378f'/>
<id>urn:sha1:750b046eb77f04f82389a8af089a4945ca2d378f</id>
<content type='text'>
In order to extend test coverage and help testing refactoring.

Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>lua: fix memory leak in set method</title>
<updated>2019-11-14T16:11:34Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2019-11-04T22:08:26Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/commit/?id=39093f3b040df895da812e2932b55feeeb1201df'/>
<id>urn:sha1:39093f3b040df895da812e2932b55feeeb1201df</id>
<content type='text'>
scan-build from clang version 9 has reported following issue:

 uci.c:624:12: warning: Potential leak of memory pointed to by 's'
       return luaL_error(L, "Cannot set an uci option to an empty table value");
              ^~~~~~~~~~

valgrind confirmed it on the supplied test case:

 ==31013== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1
 ==31013==    by 0x56C49B9: strdup (strdup.c:42)

Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>lua: fix memory leak in changes method</title>
<updated>2019-11-14T16:11:34Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2019-11-04T21:41:18Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/commit/?id=19ceff323f1e2e7df26031a9fae29fff2edc65bd'/>
<id>urn:sha1:19ceff323f1e2e7df26031a9fae29fff2edc65bd</id>
<content type='text'>
Configs returned by uci_list_configs call are not freed when not needed,
leading to the memory leak. While at it make the code cleaner.

Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>tests: add cram based unit tests</title>
<updated>2019-11-14T16:11:34Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2019-11-04T19:41:55Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/uci/commit/?id=18049a84fe402068ba10dfcffe6dbb088aefc53a'/>
<id>urn:sha1:18049a84fe402068ba10dfcffe6dbb088aefc53a</id>
<content type='text'>
I find them more flexible then shunit2 ones.

Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
</feed>
