From c45e6f7f35cfb8843a7e65ec44032d6db50dbe2b Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Sun, 30 Apr 2006 06:57:51 +0000 Subject: [PATCH] Fixed UUE and BASE64 encoding. --- golded3/geedit2.cpp | 4 ++-- goldlib/uulib/uunconc.c | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/golded3/geedit2.cpp b/golded3/geedit2.cpp index a2cdbdf..5e5419d 100644 --- a/golded3/geedit2.cpp +++ b/golded3/geedit2.cpp @@ -1042,7 +1042,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) { char ibuf[80]; char* iptr = ibuf; char* optr = _parabuf; - int n = fp.Fread(ibuf, 45); + int n = fp.Fread(ibuf, 1, 45); if (n < 45) memset(ibuf+n, 0, 45-n); *optr++ = uuencode_enc(n); @@ -1084,7 +1084,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) { { char ibuf[80]; char* optr = _parabuf; - int n = fp.Fread(ibuf, 54); + int n = fp.Fread(ibuf, 1, 54); optr = b64.encode(optr, ibuf, n); *optr++ = '\n'; *optr = NUL; diff --git a/goldlib/uulib/uunconc.c b/goldlib/uulib/uunconc.c index 0f30589..8fc1ca2 100644 --- a/goldlib/uulib/uunconc.c +++ b/goldlib/uulib/uunconc.c @@ -665,19 +665,19 @@ UUDecodeLine (char *s, char *d, int method) if ((z3 = B64xlat[ACAST(*(s+2))]) == -1) break; if ((z4 = B64xlat[ACAST(*(s+3))]) == -1) break; - d[count++] = (z1 << 2) | (z2 >> 4); - d[count++] = (z2 << 4) | (z3 >> 2); - d[count++] = (z3 << 6) | (z4); + d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF); + d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF); + d[count++] = (char)(((z3 << 6) | (z4)) & 0xFF); s += 4; } if (z1 != -1 && z2 != -1 && *(s+2) == '=') { - d[count++] = (z1 << 2) | (z2 >> 4); + d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF); s+=2; } else if (z1 != -1 && z2 != -1 && z3 != -1 && *(s+3) == '=') { - d[count++] = (z1 << 2) | (z2 >> 4); - d[count++] = (z2 << 4) | (z3 >> 2); + d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF); + d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF); s+=3; } while (B64xlat[ACAST(*s)] != -1) @@ -697,19 +697,19 @@ UUDecodeLine (char *s, char *d, int method) if ((z3 = BHxlat[ACAST(*(s+2))]) == -1) break; if ((z4 = BHxlat[ACAST(*(s+3))]) == -1) break; - d[count++] = (z1 << 2) | (z2 >> 4); - d[count++] = (z2 << 4) | (z3 >> 2); - d[count++] = (z3 << 6) | (z4); + d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF); + d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF); + d[count++] = (char)(((z3 << 6) | (z4)) & 0xFF); s += 4; } if (z1 != -1 && z2 != -1 && *(s+2) == ':') { - d[count++] = (z1 << 2) | (z2 >> 4); + d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF); s+=2; } else if (z1 != -1 && z2 != -1 && z3 != -1 && *(s+3) == ':') { - d[count++] = (z1 << 2) | (z2 >> 4); - d[count++] = (z2 << 4) | (z3 >> 2); + d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF); + d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF); s+=3; } while (BHxlat[ACAST(*s)] != -1)