Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/blob.h
AgeCommit message (Collapse)Author
2019-12-25Ensure blob_attr length check does not perform out of bounds readsTobias Schramm
Before there might have been as little as one single byte left which would result in 3 bytes of blob_attr->id_len being out of bounds. Acked-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Tobias Schramm <tobleminer@gmail.com> [line wrapped < 72 chars] Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25blob: introduce blob_parse_untrustedPetr Štetiar
blob_parse can be only used on trusted input as it has no possibility to check the length of the provided input buffer, which might lead to undefined behaviour and/or crashes when supplied with malformed, corrupted or otherwise specially crafted input. So this introduces blob_parse_untrusted variant which expects additional input buffer length argument and thus should be able to process also inputs from untrusted sources. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-20iron out all extra compiler warningsPetr Štetiar
gcc-9 on x86/64 has reported following issues: base64.c:173:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:230:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:238:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:242:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:252:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:256:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:266:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:315:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:329:15: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] blob.c:207:11: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blob.c:210:11: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blob.c:243:31: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] blob.c:246:31: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] blob.h:245:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blob.h:253:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blobmsg.h:269:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blobmsg_json.c:155:10: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] examples/../blob.h:245:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] examples/../blobmsg.h:269:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] json_script.c:590:7: error: this statement may fall through [-Werror=implicit-fallthrough=] Signed-off-by: Petr Štetiar <ynezz@true.cz>
2017-01-04blobmsg: add support for doubleAndré Gaul
This adds support for double floating point type to make it more JSON compatible. For type checking it also adds a stub BLOB_ATTR_DOUBLE type. If necessary, the accessor functions for blob can be added later Signed-off-by: André Gaul <andre@gaul.io> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-11-29blob/blobmsg: add explicit typecasts for attribute iteratorsFelix Fietkau
Fixes C++ compatibility. Reported in https://forum.lede-project.org/t/blobmsg-for-each-attr-from-c/389 Signed-off-by: Felix Fietkau <nbd@nbd.name>
2014-07-26blob: improve out-of-memory handlingewolfok
Signed-off-by: Chen Bin <ewolfok@126.com> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-09blob/blobmsg: Perform explicit casts from void* to avoid compilation errors ↵Jacob Siverskog
when using libubox from C++. Signed-off by: Jacob Siverskog <jacob@teenageengineering.com>
2014-04-27blob: make length variables unsignedFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-12blobmsg: allow data/length iterator/accessor functions to work on ↵Felix Fietkau
non-blobmsg elements This primarily helps with simplifying the ubus APIs. blobmsg header presence is indicated by the BLOB_ATTR_EXTENDED bit in the id_len field. This changes the format ABI, but not the API. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-16blob: add a magic offset to nesting cookies to ensure that NULL is never ↵Felix Fietkau
returned as a normal value Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-04blob: add blob_put_raw() for copying one or more blob attributes into the ↵Felix Fietkau
buffer directly Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-07-29blob/blobmsg: add null pointer checks to the *_for_each_attr functions, fix ↵Felix Fietkau
formatting Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-12utils: move endian swap helpers and __packed definition to utils.hFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-10blob: add blob_buf_grow()Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-23blob/blobmsg: use 32 bit load/store for 64 bit access, unaligned attributes ↵Felix Fietkau
cause data corruption on ARM Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-02blob.h: fix endian checkFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-06-01blob: add blob_memdup()Felix Fietkau
2011-11-10blob: switch to ISC license, switch blob_{get,put}_int* to _u*, add wrappersFelix Fietkau
2011-10-06fix more instances of uninitialized padding bytesFelix Fietkau
2011-10-06fill padding bytes when setting raw attribute lengthFelix Fietkau
2011-10-03fix reads beyond the end of the buffer when iterating over blob attributesFelix Fietkau
2011-09-05blob_attr_equal: un-inline, add pointer checksFelix Fietkau
2011-09-05add blob_attr_equal() for comparing attributesFelix Fietkau
2011-07-29add blob_buf_freeFelix Fietkau
2011-02-06rename blob_get_int* to blob_get_u*Felix Fietkau
2011-01-31blob: constifyFelix Fietkau
2011-01-31make blob attribute checking available externallyFelix Fietkau
2011-01-29remove blob_buf::privFelix Fietkau
2011-01-23add blobmsg validation functionFelix Fietkau
2010-12-06constify blob_attr_infoFelix Fietkau
2010-10-13Initial importFelix Fietkau