summary refs log tree commit diff stats
path: root/cutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cutils.c b/cutils.c
index 73d4e1fbbd..6196a9055c 100644
--- a/cutils.c
+++ b/cutils.c
@@ -109,6 +109,19 @@ int stristart(const char *str, const char *val, const char **ptr)
     return 1;
 }
 
+/* XXX: use host strnlen if available ? */
+int qemu_strnlen(const char *s, int max_len)
+{
+    int i;
+
+    for(i = 0; i < max_len; i++) {
+        if (s[i] == '\0') {
+            break;
+        }
+    }
+    return i;
+}
+
 time_t mktimegm(struct tm *tm)
 {
     time_t t;