ruby: Run tests one at a time, instead of in parallel.
[libguestfs.git] / daemon / strings.c
index d7dc392..778aea3 100644 (file)
@@ -33,6 +33,12 @@ do_strings_e (const char *encoding, const char *path)
   char *out, *err;
   char **lines;
 
+  if (strlen (encoding) != 1 ||
+      strchr ("sSblBL", encoding[0]) == NULL) {
+    reply_with_error ("%s: invalid encoding", encoding);
+    return NULL;
+  }
+
   buf = sysroot_path (path);
   if (!buf) {
     reply_with_perror ("malloc");
@@ -42,7 +48,7 @@ do_strings_e (const char *encoding, const char *path)
   r = command (&out, &err, "strings", "-e", encoding, buf, NULL);
   free (buf);
   if (r == -1) {
-    reply_with_error ("strings: %s: %s", path, err);
+    reply_with_error ("%s: %s", path, err);
     free (err);
     free (out);
     return NULL;