| 2002 | } |
| 2003 | |
| 2004 | int read_vstring(int f, char *buf, int bufsize) |
| 2005 | { |
| 2006 | int len = read_byte(f); |
| 2007 | |
| 2008 | if (len & 0x80) |
| 2009 | len = (len & ~0x80) * 0x100 + read_byte(f); |
| 2010 | |
| 2011 | if (len >= bufsize) { |
| 2012 | rprintf(FERROR, "over-long vstring received (%d > %d)\n", |
| 2013 | len, bufsize - 1); |
| 2014 | return -1; |
| 2015 | } |
| 2016 | |
| 2017 | if (len) |
| 2018 | read_buf(f, buf, len); |
| 2019 | buf[len] = '\0'; |
| 2020 | return len; |
| 2021 | } |
| 2022 | |
| 2023 | /* Populate a sum_struct with values from the socket. This is |
| 2024 | * called by both the sender and the receiver. */ |
no test coverage detected