]> xenbits.xensource.com Git - xen.git/commitdiff
libxlu_cfg: reject unknown characters following '\'
authorJim Fehlig <jfehlig@suse.com>
Wed, 17 Feb 2016 17:20:57 +0000 (10:20 -0700)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 17 Feb 2016 17:34:33 +0000 (12:34 -0500)
When dequoting config strings in xlu__cfgl_dequote(), unknown
characters following a '\', and the '\' itself, are discarded.
E.g. a disk configuration string containing

  rbd:pool/image:mon_host=192.168.0.100\:6789

would be dequoted as

  rbd:pool/image:mon_host=192.168.0.1006789

Instead of discarding the '\' and unknown character, reject the
string and set error to EINVAL.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxlu_cfg.c

index 1d709091cbee51e1c98f2a0fe8a0580d5138e496..5838f6885e82118f0d1ef7b608bee26d77367e93 100644 (file)
@@ -533,6 +533,11 @@ char *xlu__cfgl_dequote(CfgParseContext *ctx, const char *src) {
                 NUMERIC_CHAR(2,2,16,"hex");
             } else if (nc>='0' && nc<='7') {
                 NUMERIC_CHAR(1,3,10,"octal");
+            } else {
+                xlu__cfgl_lexicalerror(ctx,
+                           "invalid character after backlash in quoted string");
+                ctx->err= EINVAL;
+                goto x;
             }
             assert(p <= src+len-1);
         } else {