JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
A reference to padded data is passed to a function that crosses a trust boundary: for example, a function that transfers information from kernel space to user space, or from memory to a file.
For this purposes of this warning class:
| Class Name | Padding Passed Across a Trust Boundary | ||||||
|---|---|---|---|---|---|---|---|
| Significance | security | ||||||
| Mnemonic | MISC.PADDING.POTB | ||||||
| Categories |
|
||||||
| Availability | Available for C and C++. |
||||||
| Enabling | Checks for this warning class are enabled by
default. To disable them, add the following WARNING_FILTER rule to the
project configuration file.
WARNING_FILTER += discard class="Padding Passed Across a Trust Boundary" |
#include <unistd.h> /* this struct requires padding before field y */ typedef struct padded_struct { int x; char c; int y; } padded_struct_t; /* compilers will not typically pad this struct */ /* (your compiler may differ) */ typedef struct unpadded_struct{ int x; int y; } unpadded_struct_t; /* a user-defined function that does not pass data across a trust boundary */ void stay_inside_boundary(void *ptr); int misc_padding_potb(padded_struct_t *ps, unpadded_struct_t *us, int fd){ int a,b; stay_inside_boundary(ps); /* ok: data not passed across trust boundary */ stay_inside_boundary(us); /* ok: data not passed across trust boundary */ a = write(fd, ps, sizeof(*ps)); /* 'Padding Passed Across a Trust Boundary' warning issued here: * - factory settings include PASS_OVER_TRUST_BOUNDARY_CHECKED_FUNCS += 2, write * - ps is a reference to a padded struct, and is passed as 2nd argument to write() */ b = write(fd, us, sizeof(*us)); /* ok: reference passed as 2nd argument is not to padded data */ return a + b; }
CodeSonar makes its padding determinations by modeling the behaviour of your regular compiler. If you are using multiple compilers with different padding strategies, you may find that a type that is padded by one compiler is not padded by another, and so passing references to that type can trigger warnings when you build with the first compiler but not when you build with the second.
The functions whose calls are checked for this warning class are specified with configuration parameter PASS_OVER_TRUST_BOUNDARY_CHECKED_FUNCS
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.