MCPcopy Index your code
hub / github.com/RsyncProject/rsync / read_int_bounded

Function read_int_bounded

io.c:1892–1901  ·  view source on GitHub ↗

Read an int32 and verify lo <= v <= hi. On out-of-range, abort with a * protocol error naming "what". The bound is co-located with the read so it * cannot be forgotten by a downstream user. */

Source from the content-addressed store, hash-verified

1890 * protocol error naming "what". The bound is co-located with the read so it
1891 * cannot be forgotten by a downstream user. */
1892int32 read_int_bounded(int f, int32 lo, int32 hi, const char *what)
1893{
1894 int32 v = read_int(f);
1895 if (v < lo || v > hi) {
1896 rprintf(FERROR, "wire value %s out of range: %ld not in [%ld,%ld] [%s]\n",
1897 what, (long)v, (long)lo, (long)hi, who_am_i());
1898 exit_cleanup(RERR_PROTOCOL);
1899 }
1900 return v;
1901}
1902
1903/* As read_int_bounded but for varint-encoded values. */
1904int32 read_varint_bounded(int f, int32 lo, int32 hi, const char *what)

Callers

nothing calls this directly

Calls 3

read_intFunction · 0.85
rprintfFunction · 0.70
who_am_iFunction · 0.70

Tested by

no test coverage detected