Version 1.15.7.
[libguestfs.git] / daemon / strings.c
index 1ba0241..d94ac44 100644 (file)
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <config.h>
@@ -34,6 +34,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;
+  }
+
   CHROOT_IN;
   fd = open (path, O_RDONLY);
   CHROOT_OUT;