From 9a2f3d3377b82b597f00d1d8fb8ee58d141cfb95 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Fri, 9 Dec 2011 21:12:14 +0000 Subject: More string safety stuff --- Stars45/NetAuth.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Stars45/NetAuth.cpp') diff --git a/Stars45/NetAuth.cpp b/Stars45/NetAuth.cpp index 03c7917..700a876 100644 --- a/Stars45/NetAuth.cpp +++ b/Stars45/NetAuth.cpp @@ -92,7 +92,8 @@ static Text Digest(const char* salt, const char* file) ZeroMemory(digest, sizeof(digest)); if (file) { - FILE* f = fopen(file, "rb"); + FILE* f; + fopen_s(&f, file, "rb"); if (f) { SHA1 sha1; @@ -115,7 +116,7 @@ static Text Digest(const char* salt, const char* file) unsigned result[5]; if (sha1.Result(result)) { - sprintf(digest, "SHA1_%08X_%08X_%08X_%08X_%08X", + sprintf_s(digest, "SHA1_%08X_%08X_%08X_%08X_%08X", result[0], result[1], result[2], result[3], result[4]); } } @@ -162,7 +163,7 @@ NetAuth::CreateAuthResponse(int level, const char* salt) ListIter mod_iter = mods; char buffer[32]; - sprintf(buffer, "num %d ", mods.size()); + sprintf_s(buffer, "num %d ", mods.size()); response += buffer; while (++mod_iter) { -- cgit v1.1