diff mbox series

network_thread: memset REQ_INSTALL ACK/NACK msg responses

Message ID 20220806050021.2257945-1-james.hilliard1@gmail.com
State Accepted
Headers show
Series network_thread: memset REQ_INSTALL ACK/NACK msg responses | expand

Commit Message

James Hilliard Aug. 6, 2022, 5 a.m. UTC
We should memset msg.data.msg when not sending a msg in the response.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 core/network_thread.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Stefano Babic Aug. 6, 2022, 9:55 a.m. UTC | #1
Hi James,

On 06.08.22 07:00, James Hilliard wrote:
> We should memset msg.data.msg when not sending a msg in the response.
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>   core/network_thread.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/core/network_thread.c b/core/network_thread.c
> index 61de5e0..175cfae 100644
> --- a/core/network_thread.c
> +++ b/core/network_thread.c
> @@ -553,6 +553,7 @@ void *network_thread (void *data)
>   						 * Prepare answer
>   						 */
>   						msg.type = ACK;
> +						memset(msg.data.msg, 0, sizeof(msg.data.msg));
>   						should_close_socket = false;
>   
>   						/* Drop all old notification from last run */
> @@ -560,9 +561,10 @@ void *network_thread (void *data)
>   
>   						/* Wake-up the installer */
>   						pthread_cond_signal(&stream_wkup);
> -					} else
> +					} else {
>   						msg.type = NACK;
> -
> +						memset(msg.data.msg, 0, sizeof(msg.data.msg));
> +					}
>   				} else {
>   					msg.type = NACK;
>   					sprintf(msg.data.msg, "Installation in progress");

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Stefano Babic Aug. 7, 2022, 9:20 a.m. UTC | #2
On 06.08.22 07:00, James Hilliard wrote:
> We should memset msg.data.msg when not sending a msg in the response.
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>   core/network_thread.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/core/network_thread.c b/core/network_thread.c
> index 61de5e0..175cfae 100644
> --- a/core/network_thread.c
> +++ b/core/network_thread.c
> @@ -553,6 +553,7 @@ void *network_thread (void *data)
>   						 * Prepare answer
>   						 */
>   						msg.type = ACK;
> +						memset(msg.data.msg, 0, sizeof(msg.data.msg));
>   						should_close_socket = false;
>   
>   						/* Drop all old notification from last run */
> @@ -560,9 +561,10 @@ void *network_thread (void *data)
>   
>   						/* Wake-up the installer */
>   						pthread_cond_signal(&stream_wkup);
> -					} else
> +					} else {
>   						msg.type = NACK;
> -
> +						memset(msg.data.msg, 0, sizeof(msg.data.msg));
> +					}
>   				} else {
>   					msg.type = NACK;
>   					sprintf(msg.data.msg, "Installation in progress");


Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/core/network_thread.c b/core/network_thread.c
index 61de5e0..175cfae 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -553,6 +553,7 @@  void *network_thread (void *data)
 						 * Prepare answer
 						 */
 						msg.type = ACK;
+						memset(msg.data.msg, 0, sizeof(msg.data.msg));
 						should_close_socket = false;
 
 						/* Drop all old notification from last run */
@@ -560,9 +561,10 @@  void *network_thread (void *data)
 
 						/* Wake-up the installer */
 						pthread_cond_signal(&stream_wkup);
-					} else
+					} else {
 						msg.type = NACK;
-
+						memset(msg.data.msg, 0, sizeof(msg.data.msg));
+					}
 				} else {
 					msg.type = NACK;
 					sprintf(msg.data.msg, "Installation in progress");