summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-07 00:48:08 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-07 00:48:08 +0800
commit31608b78029a559ff1de6aa1188318c79c76f698 (patch)
tree0938b2d40ba1853dd775f758a6c476f53fa1144a /common
parent3a374a93478bb790ccd98afd6fc17e752d235746 (diff)
downloadpttbbs-31608b78029a559ff1de6aa1188318c79c76f698.tar
pttbbs-31608b78029a559ff1de6aa1188318c79c76f698.tar.gz
pttbbs-31608b78029a559ff1de6aa1188318c79c76f698.tar.bz2
pttbbs-31608b78029a559ff1de6aa1188318c79c76f698.tar.lz
pttbbs-31608b78029a559ff1de6aa1188318c79c76f698.tar.xz
pttbbs-31608b78029a559ff1de6aa1188318c79c76f698.tar.zst
pttbbs-31608b78029a559ff1de6aa1188318c79c76f698.zip
- fix compile warnings
- str_decode_M3: Assume output size is shorter than input size. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4501 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common')
-rw-r--r--common/sys/string.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/sys/string.c b/common/sys/string.c
index e529425c..0cfaf7f8 100644
--- a/common/sys/string.c
+++ b/common/sys/string.c
@@ -660,12 +660,12 @@ str_iconv(
/**
* inplace decode mime header string (rfc2047) to big5 encoding
*
- * @param str [in,out] string, assume buffer size 512
+ * @param str [in,out] string, output size is limited to 512. Assume output size is shorter than input size.
*
* TODO rewrite, don't hardcode 512
*/
void
-str_decode_M3(unsigned char *str)
+str_decode_M3(char *str)
{
int adj;
int i;
@@ -674,7 +674,7 @@ str_decode_M3(unsigned char *str)
unsigned char charset[512], dst1[512];
- src = str;
+ src = (unsigned char*)str;
dst = buf;
adj = 0;
@@ -729,5 +729,6 @@ str_decode_M3(unsigned char *str)
}
}
*dst = 0;
- strcpy((char*)str, (char*)buf);
+ assert(strlen(str) >= strlen(buf));
+ strcpy(str, (char*)buf);
}