[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torsocks/master] Use size_t, not int, for indices below size_t bounds.
commit 80e1ffb565bdd3c41063a743617f17faa81ab9aa
Author: Taylor R Campbell <campbell+torsocks@xxxxxxxxxx>
Date: Tue Jun 16 20:33:49 2015 +0000
Use size_t, not int, for indices below size_t bounds.
---
src/lib/recv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lib/recv.c b/src/lib/recv.c
index 1ff1446..d1bbaea 100644
--- a/src/lib/recv.c
+++ b/src/lib/recv.c
@@ -39,7 +39,7 @@ TSOCKS_LIBC_DECL(recvmsg, LIBC_RECVMSG_RET_TYPE, LIBC_RECVMSG_SIG)
*/
static void close_fds(int *fds, size_t count)
{
- int i;
+ size_t i;
for (i = 0; i < count; i++) {
tsocks_libc_close(fds[i]);
@@ -124,8 +124,8 @@ LIBC_RECVMSG_RET_TYPE tsocks_recvmsg(LIBC_RECVMSG_SIG)
* chance here of having a crazy high value that could exhaust the
* stack memory.
*/
- size_t sizeof_fds = (cmsg->cmsg_len - sizeof(*cmsg)) / sizeof(int);
- int i, fds[sizeof_fds];
+ size_t i, sizeof_fds = (cmsg->cmsg_len - sizeof(*cmsg)) / sizeof(int);
+ int fds[sizeof_fds];
memcpy(&fds, CMSG_DATA(cmsg), sizeof(fds));
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits