gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] 25/163: tftp: make sure error is zero terminated be


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 25/163: tftp: make sure error is zero terminated before printfing it
Date: Sun, 05 Aug 2018 12:35:51 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit 2e65a920523519440f3768967915f022fae9701f
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue May 22 10:10:39 2018 +0200

    tftp: make sure error is zero terminated before printfing it
---
 lib/tftp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/tftp.c b/lib/tftp.c
index b32960f82..d57af6a7a 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -1148,8 +1148,11 @@ static CURLcode tftp_receive_packet(struct connectdata 
*conn)
     case TFTP_EVENT_ERROR:
     {
       unsigned short error = getrpacketblock(&state->rpacket);
+      char *str = (char *)state->rpacket.data + 4;
+      size_t strn = state->rbytes - 4;
       state->error = (tftp_error_t)error;
-      infof(data, "%s\n", (const char *)state->rpacket.data + 4);
+      if(Curl_strnlen(str, strn) < strn)
+        infof(data, "TFTP error: %s\n", str);
       break;
     }
     case TFTP_EVENT_ACK:

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]