[PATCH] [iconv] Fix possible null-pointer dereference.

Dmitry Chestnyh d.chestnyh@omp.ru
Thu Mar 31 15:19:18 GMT 2022


This issue was found by SVACE static analyzer.
Dereference can appear at line 665 and there are no
obvious checks of `irrecersible` ptr value.
And seems that we can't be sure that this pointer
isn't NULL.
---
 iconv/skeleton.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index 0356dbf92b..a296a9f944 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -659,6 +659,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
 	      /* Store information about how many bytes are available.  */
 	      data->__outbuf = outbuf;
 
+	      assert(irreversible != NULL);
 	      /* Remember how many non-identical characters we
 		 converted in an irreversible way.  */
 	      *irreversible += lirreversible;
-- 
2.25.1



More information about the Libc-alpha mailing list