aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2007-05-27 12:43:06 +0000
committerMax Horn2007-05-27 12:43:06 +0000
commit3144ab58a6063e6658d228c4bdf22827c2249a49 (patch)
tree3ac367857981935e5ae7a9f6239eef2674ed6c00 /common
parente2af13a7f688f6447b4ec1ad30b7127323245924 (diff)
downloadscummvm-rg350-3144ab58a6063e6658d228c4bdf22827c2249a49.tar.gz
scummvm-rg350-3144ab58a6063e6658d228c4bdf22827c2249a49.tar.bz2
scummvm-rg350-3144ab58a6063e6658d228c4bdf22827c2249a49.zip
Paranoia changes (shouldn't have any real effect, though...)
svn-id: r26972
Diffstat (limited to 'common')
-rw-r--r--common/md5.cpp12
-rw-r--r--common/md5.h7
2 files changed, 10 insertions, 9 deletions
diff --git a/common/md5.cpp b/common/md5.cpp
index 700897e08f..ac90ddb2e4 100644
--- a/common/md5.cpp
+++ b/common/md5.cpp
@@ -301,37 +301,37 @@ bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length) {
return true;
}
-bool md5_file_string(const FilesystemNode &file, char md5str[32+1], uint32 length) {
+bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length) {
uint8 digest[16];
if (!md5_file(file, digest, length))
return false;
for (int i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)digest[i]);
+ snprintf(md5str + i*2, 3, "%02x", (int)digest[i]);
}
return true;
}
-bool md5_file_string(const char *name, char md5str[32+1], uint32 length) {
+bool md5_file_string(const char *name, char *md5str, uint32 length) {
uint8 digest[16];
if (!md5_file(name, digest, length))
return false;
for (int i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)digest[i]);
+ snprintf(md5str + i*2, 3, "%02x", (int)digest[i]);
}
return true;
}
-bool md5_file_string(ReadStream &stream, char md5str[32+1], uint32 length) {
+bool md5_file_string(ReadStream &stream, char *md5str, uint32 length) {
uint8 digest[16];
if (!md5_file(stream, digest, length))
return false;
for (int i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)digest[i]);
+ snprintf(md5str + i*2, 3, "%02x", (int)digest[i]);
}
return true;
diff --git a/common/md5.h b/common/md5.h
index 6700ff355f..fa03465ac8 100644
--- a/common/md5.h
+++ b/common/md5.h
@@ -35,9 +35,10 @@ bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
// The following two methods work similar to the above two, but
// instead of computing the binary MD5 digest, they produce
// a human readable lowercase hexstring representing the digest.
-bool md5_file_string(const char *name, char md5str[32+1], uint32 length = 0);
-bool md5_file_string(const FilesystemNode &file, char md5str[32+1], uint32 length = 0);
-bool md5_file_string(ReadStream &stream, char md5str[32+1], uint32 length = 0);
+// The md5str parameter must point to a buffer of 32+1 chars.
+bool md5_file_string(const char *name, char *md5str, uint32 length = 0);
+bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length = 0);
+bool md5_file_string(ReadStream &stream, char *md5str, uint32 length = 0);
} // End of namespace Common