Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check API command length, allow up to 16384 #339

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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