[PATCH 01/10] libsframe: null check arg before writing to in sframe_encoder_write

Indu Bhagat ibhagatgnu@gmail.com
Thu Aug 27 22:41:37 GMT 2026


Check for encoder_size == NULL before writing to it.
---
 libsframe/sframe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index cd6bb3022db..011884c0768 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -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);
-- 
2.43.0



More information about the Binutils mailing list