~vicamo/ubuntu/vivid/wpa/add-wowlan-support

« back to all changes in this revision

Viewing changes to wpa_supplicant/wpa_cli.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2014-10-10 09:15:39 UTC
  • Revision ID: package-import@ubuntu.com-20141010091539-ieug36j0o0trwysg
Tags: 2.1-0ubuntu4
* SECURITY UPDATE: arbitrary command execution via unsanitized string
  passed to action scripts by wpa_cli and hostapd_cli
  - debian/patches/CVE-2014-3686.patch: added os_exec() helper to
    src/utils/os.h, src/utils/os_unix.c, src/utils/os_win32.c,
    use instead of system() in wpa_supplicant/wpa_cli.c,
    hostapd/hostapd_cli.c.
  - CVE-2014-3686

Show diffs side-by-side

added added

removed removed

Lines of Context:
3109
3109
static int wpa_cli_exec(const char *program, const char *arg1,
3110
3110
                        const char *arg2)
3111
3111
{
3112
 
        char *cmd;
 
3112
        char *arg;
3113
3113
        size_t len;
3114
3114
        int res;
3115
 
        int ret = 0;
3116
 
 
3117
 
        len = os_strlen(program) + os_strlen(arg1) + os_strlen(arg2) + 3;
3118
 
        cmd = os_malloc(len);
3119
 
        if (cmd == NULL)
3120
 
                return -1;
3121
 
        res = os_snprintf(cmd, len, "%s %s %s", program, arg1, arg2);
3122
 
        if (res < 0 || (size_t) res >= len) {
3123
 
                os_free(cmd);
3124
 
                return -1;
3125
 
        }
3126
 
        cmd[len - 1] = '\0';
3127
 
#ifndef _WIN32_WCE
3128
 
        if (system(cmd) < 0)
3129
 
                ret = -1;
3130
 
#endif /* _WIN32_WCE */
3131
 
        os_free(cmd);
3132
 
 
3133
 
        return ret;
 
3115
 
 
3116
        len = os_strlen(arg1) + os_strlen(arg2) + 2;
 
3117
        arg = os_malloc(len);
 
3118
        if (arg == NULL)
 
3119
                return -1;
 
3120
        os_snprintf(arg, len, "%s %s", arg1, arg2);
 
3121
        res = os_exec(program, arg, 1);
 
3122
        os_free(arg);
 
3123
 
 
3124
        return res;
3134
3125
}
3135
3126
 
3136
3127