summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuan Hoang <tmhoang@linux.ibm.com>2021-07-15 15:57:31 +0200
committerTuan Hoang <tmhoang@linux.ibm.com>2021-07-15 15:59:37 +0200
commitfb2bec152eb5c98313329c38bb6baf59648f609b (patch)
tree399db5a85f18316446175a2b0b5eed9d9ac66772
parent7a9cc9c93c1384f72ac16d1d7980e158ec5f9f0a (diff)
downloadfio-fb2bec152eb5c98313329c38bb6baf59648f609b.tar.gz
fio-fb2bec152eb5c98313329c38bb6baf59648f609b.tar.bz2
server: fix missing le32_to_cpu conversion when opcode is FIO_NET_CMD_TEXT
Reported-by: Manuel Gotin <manuel.gotin@ibm.com> Signed-off-by: Tuan Hoang <tmhoang@linux.ibm.com>
-rw-r--r--server.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/server.c b/server.c
index 8daefbab..42eaa4b1 100644
--- a/server.c
+++ b/server.c
@@ -409,8 +409,9 @@ struct fio_net_cmd *fio_net_recv_cmd(int sk, bool wait)
if (cmdret->opcode == FIO_NET_CMD_TEXT) {
struct cmd_text_pdu *__pdu = (struct cmd_text_pdu *) cmdret->payload;
char *buf = (char *) __pdu->buf;
+ int len = le32_to_cpu(__pdu->buf_len);
- buf[__pdu->buf_len] = '\0';
+ buf[len] = '\0';
} else if (cmdret->opcode == FIO_NET_CMD_JOB) {
struct cmd_job_pdu *__pdu = (struct cmd_job_pdu *) cmdret->payload;
char *buf = (char *) __pdu->buf;