Bug 828909 - Sanitize Wi-Fi hotspot username and password r=mrbkap

This commit is contained in:
Vincent Chang 2013-01-10 16:10:48 +00:00
parent 5cdea069fb
commit 41dec500b8

View File

@ -379,13 +379,18 @@ function getTxBytes(params, callback) {
return doCommand(command, callback);
}
function escapeQuote(str) {
str = str.replace(/\\/g, "\\\\");
return str.replace(/"/g, "\\\"");
}
// The command format is "softap set wlan0 wl0.1 hotspot456 open null 6 0 8".
function setAccessPoint(params, callback) {
let command = "softap set " + params.ifname +
" " + params.wifictrlinterfacename +
" \"" + params.ssid + "\"" +
" \"" + escapeQuote(params.ssid) + "\"" +
" " + params.security +
" \"" + params.key + "\"" +
" \"" + escapeQuote(params.key) + "\"" +
" " + "6 0 8";
return doCommand(command, callback);
}