From 6e42c1b55e0fc4f360cc56010b0ffe19aa6062d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= <piponazo@gmail.com>
Date: Mon, 26 Nov 2018 14:24:14 +0100
Subject: [PATCH] Fix #561. Use proper counter for the idx variable

---
 src/easyaccess.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/easyaccess.cpp b/src/easyaccess.cpp
index 1eed30c47..9302d6cc9 100644
--- a/src/easyaccess.cpp
+++ b/src/easyaccess.cpp
@@ -154,7 +154,7 @@ namespace Exiv2 {
             std::ostringstream os;
             md_st->write(os, &ed);
             bool ok = false;
-            long st_val = parseLong(os.str(), ok);
+            const long st_val = parseLong(os.str(), ok);
             // SensivityType out of range or cannot be parsed properly
             if (!ok || st_val < 1 || st_val > 7)
                 break;
@@ -175,7 +175,7 @@ namespace Exiv2 {
                     md = md_st;
                     break;
                 }
-                while (strcmp(sensKeys->keys[idx++], md_st->key().c_str()) != 0 && idx < cnt) {}
+                while (strcmp(sensKeys->keys[idx++], md_st->key().c_str()) != 0 && idx < sensKeys->count) {}
             }
             break;
         }
