Skip to content

Commit

Permalink
More robustness fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
smowton committed Feb 8, 2016
1 parent 3927143 commit 2b8faeb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/increadimail_convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define MAX_CHAR 256

typedef enum INCREDIMAIL_VERSIONS {
INCREDIMAIL_VERSION_UNKNOWN,
INCREDIMAIL_XE,
INCREDIMAIL_2,
};
Expand Down
2 changes: 1 addition & 1 deletion Source/incredimail_convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ int total_count = 1;

enum INCREDIMAIL_VERSIONS FindIncredimailVersion( char *directory_search ) {
char temp_path[MAX_CHAR];
enum INCREDIMAIL_VERSIONS ret;
enum INCREDIMAIL_VERSIONS ret = INCREDIMAIL_VERSION_UNKNOWN;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;

Expand Down
12 changes: 12 additions & 0 deletions Source/winmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,13 @@ enum INCREDIMAIL_VERSION incredimail_version;
read_length = ReadOneLine( inputfile, im_database_filename, MAX_CHAR );
// cleaning up the line feeds from FindDatabaseFiles function
i = (int) strlen( im_database_filename );
if (i < 2) {
char msg[MAX_CHAR];
snprintf(msg, MAX_CHAR, "Ignoring invalid filename %s", im_database_filename);
MessageBox(global_hwnd, msg, "Error!", MB_OK);
continue;
}

im_database_filename[i-2] = 0;

if( read_length != 0 ) {
Expand All @@ -601,6 +608,11 @@ enum INCREDIMAIL_VERSION incredimail_version;
pdest = strrchr( im_database_filename, '\\' );
strncpy_s( temp_path, sizeof(temp_path), im_database_filename, strlen( im_database_filename ) - strlen( pdest ) );
incredimail_version = FindIncredimailVersion( temp_path );
if (incredimail_version == INCREDIMAIL_VERSION_UNKNOWN) {
char msg[CHAR_MAX];
sprintf_s(msg, CHAR_MAX, "Directory %s doesn't match a known Incredimail version", temp_path);
continue;
}

if( incredimail_version == INCREDIMAIL_XE ) {
// get the header filename
Expand Down

0 comments on commit 2b8faeb

Please sign in to comment.