diff options
author | Fritz Elfert <felfert@to.com> | 2001-06-29 10:20:52 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2001-06-29 10:20:52 +0000 |
commit | 7fae084ef37fc31c9f9ec9006d44bd5835678dfe (patch) | |
tree | 8d4a48f23c6c8ef14a2c2dcd815facffe77c8546 | |
parent | bf74b2d726fd40bd19136ae385687f63ce14ff82 (diff) | |
download | plptools-7fae084ef37fc31c9f9ec9006d44bd5835678dfe.tar.gz plptools-7fae084ef37fc31c9f9ec9006d44bd5835678dfe.tar.bz2 plptools-7fae084ef37fc31c9f9ec9006d44bd5835678dfe.zip |
Applied patch from Jim Hague.
-rw-r--r-- | lib/rfsv16.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/rfsv16.cc b/lib/rfsv16.cc index f6518d9..15bb0aa 100644 --- a/lib/rfsv16.cc +++ b/lib/rfsv16.cc @@ -541,9 +541,10 @@ fread(const u_int32_t handle, unsigned char * const buf, const u_int32_t len, u_ { Enum<rfsv::errs> res; unsigned char *p = buf; + long l; count = 0; - while (count < len) { + do { bufferStore a; // Read in blocks of 291 bytes; the maximum payload for @@ -564,11 +565,12 @@ fread(const u_int32_t handle, unsigned char * const buf, const u_int32_t len, u_ return E_PSI_GEN_NONE; return res; } - long l = a.getLen(); - memcpy(buf, a.getString(), l); - count += l; - p += l; - } + if ((l = a.getLen()) > 0) { + memcpy(p, a.getString(), l); + count += l; + p += l; + } + } while ((count < len) && (l > 0)); return res; } |