X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fstrings.c;h=d94ac44eb51f8456f7f300c0cc8770e689e914c5;hb=04ea1375c55aa67df4e7fc61dbb534111767f3b6;hp=1ba02419e8fb81c77b9edb3001e165ee7fba02a5;hpb=26991ebb8181b57f4c8454f2862c938d7c5d012d;p=libguestfs.git diff --git a/daemon/strings.c b/daemon/strings.c index 1ba0241..d94ac44 100644 --- a/daemon/strings.c +++ b/daemon/strings.c @@ -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 @@ -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;