Skip to content

Commit

Permalink
Merge pull request #339 from champtar/api-command-len
Browse files Browse the repository at this point in the history
Check API command length, allow up to 16384
  • Loading branch information
nhorman authored Jan 31, 2025
2 parents 9322ac1 + 105b155 commit f45f62c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions irqbalance.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,12 @@ void get_object_stat(struct topo_obj *object, void *data)
#ifdef HAVE_IRQBALANCEUI
gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attribute__((unused)))
{
char buff[500];
char buff[16384];
int sock;
int recv_size = 0;
int valid_user = 0;

struct iovec iov = { buff, 500 };
struct iovec iov = { buff, sizeof(buff) };
struct msghdr msg = {
.msg_iov = &iov,
.msg_iovlen = 1,
Expand All @@ -426,6 +426,10 @@ gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attri
log(TO_ALL, LOG_WARNING, "Error while receiving data.\n");
goto out_close;
}
if (recv_size == sizeof(buff)) {
log(TO_ALL, LOG_WARNING, "Received command too long.\n");
goto out_close;
}
cmsg = CMSG_FIRSTHDR(&msg);
if (!cmsg) {
log(TO_ALL, LOG_WARNING, "Connection no memory.\n");
Expand Down

0 comments on commit f45f62c

Please sign in to comment.