Use sscanf with bounded %s 70/133670/3 accepted/tizen/3.0/common/20170614.125002 accepted/tizen/3.0/mobile/20170614.000402 accepted/tizen/3.0/tv/20170614.000404 accepted/tizen/3.0/wearable/20170614.000407 submit/tizen_3.0/20170613.083516
authorDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 13 Jun 2017 05:23:16 +0000 (08:23 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 13 Jun 2017 07:19:14 +0000 (10:19 +0300)
Change-Id: I549ac093a792fb866fee1d677e85e1e0857e258d

webprobe/webprobe_debugfs.c

index a27263b..f6fa06b 100644 (file)
@@ -96,6 +96,7 @@ static ssize_t write_app_info(struct file *file, const char __user *user_buf,
 {
        int ret = 0;
        char *buf, *path, *id;
+       char pattern[64];
        int n;
 
        if (count > max_count)
@@ -124,7 +125,9 @@ static ssize_t write_app_info(struct file *file, const char __user *user_buf,
                goto free_path;
        }
 
-       n = sscanf(buf, "%s %s", path, id);
+       snprintf(pattern, sizeof(pattern), "%%%ds %%%ds", count - 1, count - 1);
+
+       n = sscanf(buf, pattern, path, id);
 
        if (n != 2) {
                ret = -EINVAL;