[01/10] libsframe: null check arg before writing to in sframe_encoder_write
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
Check for encoder_size == NULL before writing to it.
---
libsframe/sframe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -2708,7 +2708,8 @@ sframe_encoder_write (sframe_encoder_ctx *ectx, size_t *encoded_size,
/* Initialize the encoded_size to zero. This makes it simpler to just
return from the function in case of failure. Free'ing up of
ectx->sfe_data is the responsibility of the caller. */
- *encoded_size = 0;
+ if (encoded_size != NULL)
+ *encoded_size = 0;
if (ectx == NULL || encoded_size == NULL || errp == NULL)
return sframe_ret_set_errno (errp, SFRAME_ERR_INVAL);