You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/02/13 15:16:11 UTC

[incubator-nuttx] branch master updated: net/can/can_setsockopt.c: fix assertion, value can be NULL

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b678ab  net/can/can_setsockopt.c: fix assertion, value can be NULL
5b678ab is described below

commit 5b678ab12e02824ba32adbc694574c726845fe14
Author: raiden00pl <ra...@railab.me>
AuthorDate: Sat Feb 12 22:27:52 2022 +0100

    net/can/can_setsockopt.c: fix assertion, value can be NULL
---
 net/can/can_setsockopt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/can/can_setsockopt.c b/net/can/can_setsockopt.c
index b5c4576..edd6e07 100644
--- a/net/can/can_setsockopt.c
+++ b/net/can/can_setsockopt.c
@@ -76,7 +76,9 @@ int can_setsockopt(FAR struct socket *psock, int option,
   int ret = OK;
   int count = 0;
 
-  DEBUGASSERT(psock != NULL && value != NULL && psock->s_conn != NULL);
+  DEBUGASSERT(psock != NULL && psock->s_conn != NULL);
+  DEBUGASSERT(value_len == 0 || value != NULL);
+
   conn = (FAR struct can_conn_s *)psock->s_conn;
 
   if (psock->s_type != SOCK_RAW)
@@ -147,9 +149,9 @@ int can_setsockopt(FAR struct socket *psock, int option,
             return -EINVAL;
           }
 
-          conn->fd_frames = *(FAR int32_t *)value;
+        conn->fd_frames = *(FAR int32_t *)value;
 
-          break;
+        break;
 #endif
 
       case CAN_RAW_JOIN_FILTERS: