Skip to content

Commit

Permalink
swig: Cast some values to get proper passing of values
Browse files Browse the repository at this point in the history
Cast, the size_t will be wrong, and the void * should be cast to char *.

Found by CodeQL

Signed-off-by: Corey Minyard <[email protected]>
  • Loading branch information
cminyard committed Apr 18, 2024
1 parent 92739d3 commit 24ddffa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion swig/OpenIPMI.i
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ sol_data_received_cb(ipmi_sol_conn_t *conn,

conn_ref = swig_make_ref(conn, ipmi_sol_conn_t);
swig_call_cb_rv('i', &rv, cb, "sol_data_received", "%p%*s",
&conn_ref, count, buf);
&conn_ref, (int) count, (char *) buf);
swig_free_ref_check(conn_ref, ipmi_sol_conn_t);
return rv;
}
Expand Down
2 changes: 1 addition & 1 deletion swig/python/OpenIPMI_lang.i
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ vswig_call_cb_rv(char rv_type, void *rv,
case 'b':
/* An array characters with length, as chars. May
include nuls */
len = va_arg(ap, size_t);
len = va_arg(ap, int);
data = va_arg(ap, void *);
o = OI_PI_FromStringAndSize(data, len);
break;
Expand Down

0 comments on commit 24ddffa

Please sign in to comment.