From 3580c5640c5578f508e93a8a851231b389d327cd Mon Sep 17 00:00:00 2001 From: Saya Sugiura Date: Thu, 23 May 2019 13:56:33 +0900 Subject: daemon: Remove bytes_sent When it fails to send a log message to connected client, daemon tries to store the remaining partial message to internal ring buffer and send again later. When calculating the number of bytes which were sent to client, it had a bug which it keeps on incrementing instead of initializing the variable on every message, which never reached to the condition mentioned above and had a possibility to overflow and access invalid memory. On the other hand, daemon doesn't need to store the unsent partial message, as the socket to the client will be closed on failure and the sent partial message will be dropped anyways. This commit removes the lines where the daemon tries to store the partial message to ring buffer. With this, variable bytes_sent is now removed. Related commit: 2262f8b Made socket send reliable Signed-off-by: Saya Sugiura --- include/dlt/dlt_common.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h index fc02743..cab860d 100644 --- a/include/dlt/dlt_common.h +++ b/include/dlt/dlt_common.h @@ -769,7 +769,6 @@ typedef struct char *buf; /**< pointer to position within receiver buffer */ char *backup_buf; /** pointer to the buffer with partial messages if any **/ int fd; /**< connection handle */ - int32_t bytes_sent; /**< total bytes sent in a single msg */ int32_t buffersize; /**< size of receiver buffer */ } DltReceiver; -- cgit v1.2.1