Skip to content

Commit

Permalink
Fixed issue with loading the HIBP file (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaifm committed Mar 25, 2018
1 parent 5176ac2 commit 571ea89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions HIBPOfflineCheckExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
using KeePassLib.Security;
using System.Diagnostics;
using System.Collections;
using KeePassLib.Utility;
using KeePass.Util;

namespace HIBPOfflineCheck
{
Expand Down Expand Up @@ -101,7 +103,8 @@ public override void PerformCellAction(string strColumnName, PwEntry pe)
}
pwd_sha_str = pwd_sha_str.ToUpperInvariant();

var files = Directory.GetFiles(".", HIBPFileName);
string appdir = UrlUtil.GetFileDirectory(WinUtil.GetExecutable(), false, true);
var files = Directory.GetFiles(appdir, HIBPFileName);
if (files.Length == 0)
{
Status = "HIBP file not found";
Expand Down Expand Up @@ -131,8 +134,10 @@ public override void PerformCellAction(string strColumnName, PwEntry pe)

line = sr.ReadLine();

if (sr.EndOfStream) break;

// We may have read only a partial line so read again to make sure we get a full line
if ((middle > 0) && (!sr.EndOfStream)) line = sr.ReadLine() ?? "";
if (middle > 0) line = sr.ReadLine() ?? "";

int compare = String.Compare(pwd_sha_str, line.Substring(0, sha_len), StringComparison.Ordinal);

Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
:
HIBPOfflineCheck:1.0.0.0
HIBPOfflineCheck:1.1.0.0
:

0 comments on commit 571ea89

Please sign in to comment.