projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Compact input buffer before trying to read instead of after.
[tinc]
/
src
/
meta.c
diff --git
a/src/meta.c
b/src/meta.c
index
ac93775
..
cf6b9d4
100644
(file)
--- a/
src/meta.c
+++ b/
src/meta.c
@@
-85,6
+85,13
@@
bool receive_meta(connection_t *c) {
- If not, keep stuff in buffer and exit.
*/
- If not, keep stuff in buffer and exit.
*/
+ buffer_compact(&c->inbuf);
+
+ if(sizeof inbuf <= c->inbuf.len) {
+ logger(LOG_ERR, "Input buffer full for %s (%s)\n");
+ return false;
+ }
+
inlen = recv(c->socket, inbuf, sizeof inbuf - c->inbuf.len, 0);
if(inlen <= 0) {
inlen = recv(c->socket, inbuf, sizeof inbuf - c->inbuf.len, 0);
if(inlen <= 0) {
@@
-151,7
+158,5
@@
bool receive_meta(connection_t *c) {
}
} while(inlen);
}
} while(inlen);
- buffer_compact(&c->inbuf);
-
return true;
}
return true;
}