Comments (3)
Looks like the only places this would be exposed as an API change are in the typedefs of the three callback functions, xo_formatter_t, xo_checkpointer_t, and xo_simplify_field_func_t. The first two are using for external encoders and the last for custom i18n. These are all rarely used, which should minimize the impact of the fix.
Thanks,
Phil
On Oct 26, 2016, at 6:39 PM, workbbraun [email protected] wrote:
Internally, it appears libxo is essentially only using two integer types, 'int' and 'unsigned'. Both of these are frequently 32bits even on 64bit systems.
Throughout libxo, pointer arithmetic is being done and storing the value in 'int' types. Nearly all of libxo/xo_buf.h's inline functions are this way.
Buffer sizes, lengths, and positive-only offsets should be size_t, and offsets that need negative values should be ssize_t.
Unfortunately, this affect nearly every type and function in libxo, including its API. Even the formatter function that is ostensibly derived from vsnprintf uses an int for buffer size instead of vsnprintf's size_t. Similarly, write() derived functions operate on ints instead of size_t and ssize_t.
This affects the internal wrapper functions xo_strn* that take a -1 and then do a strlen() on the input, since all strn* functions properly take a size_t for the buffer size, but the wrappers take an int in order to accommodate the -1 behavior.
There seems to be a lot of potential for vulnerabilities in just the integer type conversions and sign mismatches.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #55, or mute the thread https://github.com/notifications/unsubscribe-auth/ACLkOPgBZ3w9spM3VeC4WBz0sly5MIIDks5q39aqgaJpZM4KhwJT.
from libxo.
Apologies. Sloppiness on my part. Will address these in the next release, which will require an API change.
Thanks,
Phil
On Oct 26, 2016, at 6:39 PM, workbbraun [email protected] wrote:
Internally, it appears libxo is essentially only using two integer types, 'int' and 'unsigned'. Both of these are frequently 32bits even on 64bit systems.
Throughout libxo, pointer arithmetic is being done and storing the value in 'int' types. Nearly all of libxo/xo_buf.h's inline functions are this way.
Buffer sizes, lengths, and positive-only offsets should be size_t, and offsets that need negative values should be ssize_t.
Unfortunately, this affect nearly every type and function in libxo, including its API. Even the formatter function that is ostensibly derived from vsnprintf uses an int for buffer size instead of vsnprintf's size_t. Similarly, write() derived functions operate on ints instead of size_t and ssize_t.
This affects the internal wrapper functions xo_strn* that take a -1 and then do a strlen() on the input, since all strn* functions properly take a size_t for the buffer size, but the wrappers take an int in order to accommodate the -1 behavior.
There seems to be a lot of potential for vulnerabilities in just the integer type conversions and sign mismatches.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #55, or mute the thread https://github.com/notifications/unsubscribe-auth/ACLkOPgBZ3w9spM3VeC4WBz0sly5MIIDks5q39aqgaJpZM4KhwJT.
from libxo.
Fixed in 0.7.2.
from libxo.
Related Issues (20)
- "xo" needs a means of handling lists and instances HOT 1
- Newline before closing brace in json output HOT 2
- libtool makes unreliable executable names HOT 1
- 1.3.1 Ubuntu 18.04 WSL missing so HOT 3
- typo HOT 2
- Fails to build with GCC on FreeBSD HOT 2
- check width of unicode characters
- FreeBSD's json format prints an unescaped new line before the final closing bracket HOT 2
- No man page for xo_emit_field() HOT 6
- Man pages not escaping some newlines (PR included) HOT 1
- XOF_UNDERSCORES: hyphens in topmost keys are not replaced HOT 2
- xo/xo.c#L99: add missing UNUSED marker for all unused flags HOT 2
- libxo inconsistent field truncation HOT 3
- Linux: <sys/sysctl.h> missing HOT 2
- Core dump when compile with gcc 10 HOT 3
- xo.h defines NORETURN and PRINTFLIKE without a "XO_" prefix
- adding keys test_05 changes padding output for HIPx HOT 2
- Incorrect usage of an internal Glibc header (sys/cdefs.h) HOT 2
- Best approach to create a nested JSON object HOT 2
- need 'logger' equivalent for sd-pararms
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libxo.