1
- // $Id$
1
+ // $Id$
2
2
3
3
#include " main.h"
4
4
#include " ssdeep.h"
@@ -13,7 +13,7 @@ bool display_result(state *s, const TCHAR * fn, const char * sum) {
13
13
14
14
try {
15
15
f = new Filedata (fn, sum);
16
- }
16
+ }
17
17
catch (std::bad_alloc) {
18
18
fatal_error (" %s: Unable to create Filedata object in engine.cpp:display_result()" , __progname);
19
19
}
@@ -61,12 +61,12 @@ int hash_file(state *s, TCHAR *fn) {
61
61
TCHAR *my_filename, *msg;
62
62
FILE *handle;
63
63
64
- #ifdef WIN32
64
+ #ifdef WIN32
65
65
TCHAR expanded_fn[SSDEEP_PATH_MAX];
66
66
if (not expanded_path (fn) && !(s->mode & mode_relative)) {
67
- _sntprintf (expanded_fn,
67
+ _sntprintf (expanded_fn,
68
68
SSDEEP_PATH_MAX,
69
- _TEXT (" \\\\ ?\\ %s" ),
69
+ _TEXT (" \\\\ ?\\ %s" ),
70
70
fn);
71
71
} else {
72
72
_tcsncpy (expanded_fn, fn, SSDEEP_PATH_MAX);
@@ -89,7 +89,8 @@ int hash_file(state *s, TCHAR *fn) {
89
89
return TRUE ;
90
90
}
91
91
92
- if ((msg = (TCHAR *)malloc (sizeof (TCHAR) * (MAX_STATUS_MSG + 2 ))) == NULL )
92
+ #define MSG_LENGTH (MAX_STATUS_MSG + 20 )
93
+ if ((msg = (TCHAR *)malloc (sizeof (TCHAR) * MSG_LENGTH)) == NULL )
93
94
{
94
95
free (sum);
95
96
fclose (handle);
@@ -111,9 +112,9 @@ int hash_file(state *s, TCHAR *fn) {
111
112
my_filename = fn;
112
113
113
114
_sntprintf (msg,
114
- MAX_STATUS_MSG -1 ,
115
- _TEXT (" Hashing: %s%s" ),
116
- my_filename,
115
+ MSG_LENGTH -1 ,
116
+ _TEXT (" Hashing: %s%s" ),
117
+ my_filename,
117
118
_TEXT (BLANK_LINE));
118
119
_ftprintf (stderr,_TEXT (" %s\r " ), msg);
119
120
0 commit comments