[vlc-commits] Do not truncate the last character in net_Gets().

Georgi Chorbadzhiyski git at videolan.org
Sat Aug 17 20:52:36 CEST 2013


vlc/vlc-2.1 | branch: master | Georgi Chorbadzhiyski <gf at unixsol.org> | Sat Aug 17 21:31:51 2013 +0300| [7f87c3bd24f9ecec42080f82a012d811e09189b0] | committer: Rémi Denis-Courmont

Do not truncate the last character in net_Gets().

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit 313194d7faee9a4faf0c0b25f621f09d1f91d4b5)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=7f87c3bd24f9ecec42080f82a012d811e09189b0
---

 src/network/io.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/network/io.c b/src/network/io.c
index 740c990..a8ea870 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -481,9 +481,9 @@ char *net_Gets(vlc_object_t *obj, int fd, const v_socket_t *vs)
         buflen++;
     }
 
-    buf[--buflen] = '\0';
+    buf[buflen] = '\0';
     if (buflen > 0 && buf[buflen - 1] == '\r')
-        buf[buflen] = '\0';
+        buf[buflen - 1] = '\0';
     return buf;
 error:
     free(buf);



More information about the vlc-commits mailing list