diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 2f869d909..9b149de80 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -515,8 +515,9 @@ template<typename T>
 T readLittleEndian(unsigned char * p)
 {
     T x = 0;
-    for (size_t i = 0; i < sizeof(x); ++i)
-        x |= ((T) *p++) << (i * 8);
+    for (size_t i = 0; i < sizeof(x); ++i, ++p) {
+        x |= ((T) *p) << (i * 8);
+    }
     return x;
 }