public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [sunrpc] Fix possible null-pointer dereference.
@ 2022-03-31 13:32 Dmitry Chestnyh
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Chestnyh @ 2022-03-31 13:32 UTC (permalink / raw)
  To: libc-alpha; +Cc: Dmitry Chestnyh

This issue was found by SVACE static analyzer.
In clntunix_call function there are no
obvious checks of xdr_results ptr value.
And seems that we can't be sure that this pointer
isn't NULL.
---
 sunrpc/clnt_unix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index 33a02cc8af..8c303d3ef6 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -278,6 +278,7 @@ call_again:
   _seterr_reply (&reply_msg, &(ct->ct_error));
   if (ct->ct_error.re_status == RPC_SUCCESS)
     {
+      assert(xdr_results != NULL);
       if (!AUTH_VALIDATE (h->cl_auth, &reply_msg.acpted_rply.ar_verf))
 	{
 	  ct->ct_error.re_status = RPC_AUTHERROR;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] [sunrpc] Fix possible null-pointer dereference.
@ 2022-03-31 14:10 Dmitry Chestnyh
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Chestnyh @ 2022-03-31 14:10 UTC (permalink / raw)
  To: libc-alpha; +Cc: Dmitry Chestnyh

This issue was found by SVACE static analyzer.
In clntunix_call function there are no
obvious checks of xdr_results ptr value.
And seems that we can't be sure that this pointer
isn't NULL.
---
 sunrpc/clnt_unix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index 33a02cc8af..ef8ef5fb4d 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -44,6 +44,7 @@
  * Now go hang yourself.
  */
 
+#include <assert.h>
 #include <netdb.h>
 #include <errno.h>
 #include <stdio.h>
@@ -278,6 +279,7 @@ call_again:
   _seterr_reply (&reply_msg, &(ct->ct_error));
   if (ct->ct_error.re_status == RPC_SUCCESS)
     {
+      assert(xdr_results != NULL);
       if (!AUTH_VALIDATE (h->cl_auth, &reply_msg.acpted_rply.ar_verf))
 	{
 	  ct->ct_error.re_status = RPC_AUTHERROR;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-31 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 13:32 [PATCH] [sunrpc] Fix possible null-pointer dereference Dmitry Chestnyh
2022-03-31 14:10 Dmitry Chestnyh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).