tidying
[exim.git] / src / src / string.c
index 76e47f4184a061d71a2e8f1ad3b390348735319f..e169a9f057076ff42995949f7b87f76ee2f9eff6 100644 (file)
@@ -1013,12 +1013,17 @@ return new;
 static const uschar *
 Ustrnchr(const uschar * s, int c, unsigned * len)
 {
-while (*len)
+unsigned siz = *len;
+while (siz)
   {
   if (!*s) return NULL;
-  if (*s == c) return s;
+  if (*s == c)
+    {
+    *len = siz;
+    return s;
+    }
   s++;
-  *len--;
+  siz--;
   }
 return NULL;
 }