if (epoll_ctl(cs->epoll_fd, EPOLL_CTL_ADD, cs->listen_fd, &events) < 0) {
close(cs->listen_fd);
- close(cs->epoll_fd);
+ if (cs->epoll_fd >= 0) {
+ close(cs->epoll_fd);
+ }
}
}
#endif
if (!ip) {
LOG_SEVERE("invalid connected ip\n");
+ g_free(msg);
+ msg = NULL;
return;
}
if (!port) {
LOG_SEVERE("invalid connected port\n");
+ g_free(msg);
+ msg = NULL;
return;
}
g_snprintf(data, sizeof(data) - 1, "%s:%d", ip, port);
ret = send_monitor_ntf((char *)mon->outbuf, mon->outbuf_index);
memset(mon->outbuf, 0, sizeof(mon->outbuf));
mon->outbuf_index = 0;
- if (ret < -1) {
- ecs_client_close(clii);
- }
+ TRACE("ecs_monitor_flush return value of send_monitor_ntf : %d, \n", ret);
}
}
char cmd[10] = "TUNER_DTV";
if (strlen(info->map_table_path) < MAX_PATH_LEN) {
- sprintf(data, "%d:%d:%d:%d:%d:%d:%s", info->is_streaming, info->frequency, info->modulation,
+ snprintf(data, sizeof(data), "%d:%d:%d:%d:%d:%d:%s", info->is_streaming, info->frequency, info->modulation,
info->system, info->country, info->playmode, info->map_table_path);
}
} else if (action == TUNER_CHANGE_CONF) {
//call change file function
char *path = data;
- marutuner_set_table_file(path);
- LOG_TRACE("tuner : change configuration file : %s \n", data);
+ if (path != NULL) {
+ marutuner_set_table_file(path);
+ LOG_TRACE("tuner : change configuration file : %s \n", data);
+ } else {
+ LOG_TRACE("tuner : path is NULL");
+ }
+
} else {
char token[] = ":";
char *section = strtok(data, token);
{
char cmd[10];
memset(cmd, 0, 10);
- strcpy(cmd, msg->category);
+
+ if(strlen(msg->category) > 10) {
+ return false;
+ }
+ strncpy(cmd, msg->category, sizeof(cmd));
LOG_TRACE(">> device_req: header = cmd = %s, length = %d, action=%d, group=%d\n",
cmd, msg->length, msg->action, msg->group);
if (group == MSG_GROUP_STATUS) {
switch (action) {
case MSG_ACT_BATTERY_LEVEL:
- sprintf(data, "%d", get_power_capacity());
+ snprintf(data, sizeof(data), "%d", get_power_capacity());
break;
case MSG_ACT_BATTERY_CHARGER:
- sprintf(data, "%d", get_jack_charger());
+ snprintf(data, sizeof(data), "%d", get_jack_charger());
break;
case MSG_ACT_USB:
- sprintf(data, "%d", get_jack_usb());
+ snprintf(data, sizeof(data), "%d", get_jack_usb());
break;
case MSG_ACT_EARJACK:
- sprintf(data, "%d", get_jack_earjack());
+ snprintf(data, sizeof(data), "%d", get_jack_earjack());
break;
case MSG_ACT_LOCATION:
qemu_mutex_lock(&mutex_location_data);
- sprintf(data, "%s", location_data);
+ snprintf(data, sizeof(data), "%s", location_data);
qemu_mutex_unlock(&mutex_location_data);
break;
default:
char *addon = strtok((char *)data, token);
#ifndef CONFIG_WIN32
- ret = sprintf(cmd, "\"%s%s\" -s emulator-%d push \"%s%s%s%s%s\" %s%s 2>&1",
+ ret = snprintf(cmd, sizeof(cmd), "\"%s%s\" -s emulator-%d push \"%s%s%s%s%s\" %s%s 2>&1",
#else
- ret = sprintf(cmd, "cmd /S /C \"\"%s%s\" -s emulator-%d push \"%s%s%s%s%s\" %s%s 2>&1\"",
+ ret = snprintf(cmd, sizeof(cmd), "cmd /S /C \"\"%s%s\" -s emulator-%d push \"%s%s%s%s%s\" %s%s 2>&1\"",
#endif
bin_dir, sdb_path, get_vm_device_serial_number(),
bin_dir, platform_path, get_profile_name(), addon_path, addon,
char *addon = strtok(data, token);
memset(fail_msg, 0, sizeof(fail_msg));
- strcpy(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_1);
- strcat(fail_msg, addon);
- strcat(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_2);
+ strncpy(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_1, sizeof(fail_msg));
+ if (addon != NULL && (strlen(addon)+strlen(fail_msg)) < MAX_PKGS_LIST) {
+ strncat(fail_msg, addon, strlen(addon));
+ }
+ if ((strlen(FAILED_TO_INSTALL_EXTRAPACKAGE_2)+strlen(fail_msg)) < MAX_PKGS_LIST) {
+ strncat(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_2, strlen(FAILED_TO_INSTALL_EXTRAPACKAGE_2));
+ }
error_report("%s", fail_msg);
}
memset(cmd, 0, sizeof(cmd));
#ifndef CONFIG_WIN32
- ret = sprintf(cmd, "\"%s%s\" -s emulator-%d root on",
+ ret = snprintf(cmd, sizeof(cmd), "\"%s%s\" -s emulator-%d root on",
#else
- ret = sprintf(cmd, "cmd /S /C \"\"%s%s\" -s emulator-%d root on\"",
+ ret = snprintf(cmd, sizeof(cmd), "cmd /S /C \"\"%s%s\" -s emulator-%d root on\"",
#endif
bin_dir, sdb_path, get_vm_device_serial_number());
if (ret < 0) {
memset(cmd, 0, sizeof(cmd));
#ifndef CONFIG_WIN32
- ret = sprintf(cmd, "\"%s%s\" -s emulator-%d shell \"mount -o remount,rw /\"",
+ ret = snprintf(cmd, sizeof(cmd), "\"%s%s\" -s emulator-%d shell \"mount -o remount,rw /\"",
#else
- ret = sprintf(cmd, "cmd /S /C \"\"%s%s\" -s emulator-%d shell \"mount -o remount,rw /\"\"",
+ ret = snprintf(cmd, sizeof(cmd), "cmd /S /C \"\"%s%s\" -s emulator-%d shell \"mount -o remount,rw /\"\"",
#endif
bin_dir, sdb_path, get_vm_device_serial_number());
if (ret < 0) {
memset(cmd, 0, sizeof(cmd));
#ifndef CONFIG_WIN32
- ret = sprintf(cmd, "\"%s%s\" -s emulator-%d shell \"mount -o remount,ro /\"",
+ ret = snprintf(cmd, sizeof(cmd), "\"%s%s\" -s emulator-%d shell \"mount -o remount,ro /\"",
#else
- ret = sprintf(cmd, "cmd /S /C \"\"%s%s\" -s emulator-%d shell \"mount -o remount,ro /\"\"",
+ ret = snprintf(cmd, sizeof(cmd), "cmd /S /C \"\"%s%s\" -s emulator-%d shell \"mount -o remount,ro /\"\"",
#endif
bin_dir, sdb_path, get_vm_device_serial_number());
if (ret < 0) {
}
memset(cmd, 0, sizeof(cmd));
#ifndef CONFIG_WIN32
- ret = sprintf(cmd, "\"%s%s\" -s emulator-%d root off",
+ ret = snprintf(cmd, sizeof(cmd), "\"%s%s\" -s emulator-%d root off",
#else
- ret = sprintf(cmd, "cmd /S /C \"\"%s%s\" -s emulator-%d root off\"",
+ ret = snprintf(cmd, sizeof(cmd), "cmd /S /C \"\"%s%s\" -s emulator-%d root off\"",
#endif
bin_dir, sdb_path, get_vm_device_serial_number());
if (ret < 0) {
image_info->actual_size);
}
get_human_readable_size(size_buf, sizeof(size_buf), image_info->virtual_size);
- length += sprintf(data + length,
+ length += snprintf(data + length, (sizeof(data) - length),
"\nimage: %s\n"
"file format: %s\n"
"virtual size: %s (%" PRId64 " bytes)\n"
memset(tmp, 0, sizeof(tmp));
- sprintf(tmp, "%d,%d,%d", x, y, z);
+ snprintf(tmp, sizeof(tmp), "%d,%d,%d", x, y, z);
set_sensor_accel(tmp, strlen(tmp));
}
memset(tmp, 0, sizeof(tmp));
- sprintf(tmp, "%d, %d", pressure, temperature);
+ snprintf(tmp, sizeof(tmp), "%d, %d", pressure, temperature);
set_sensor_pressure(tmp, strlen(tmp));
}
memset(tmp, 0, sizeof(tmp));
if (index == 0) {
- sprintf(tmp, "%d, %d", hrm, rri);
+ snprintf(tmp, sizeof(tmp), "%d, %d", hrm, rri);
set_sensor_hrm(tmp, strlen(tmp));
} else if (index == 1) {
- sprintf(tmp, "%d", hrm);
+ snprintf(tmp, sizeof(tmp), "%d", hrm);
set_sensor_hrm_heart(tmp, strlen(tmp));
} else if (index == 2) {
- sprintf(tmp, "%d", rri);
+ snprintf(tmp, sizeof(tmp), "%d", rri);
set_sensor_hrm_rri(tmp, strlen(tmp));
} else {
LOG_SEVERE("unknown index with data '%s' & index '%d'\n", data, index);
memset(tmp, 0, sizeof(tmp));
- sprintf(tmp, "%d %d %d", x, y, z);
+ snprintf(tmp, sizeof(tmp), "%d %d %d", x, y, z);
set_sensor_gyro(tmp, strlen(tmp));
}
memset(tmp, 0, sizeof(tmp));
- sprintf(tmp, "%d %d %d %d", x, y, z, accuracy);
+ snprintf(tmp, sizeof(tmp), "%d %d %d %d", x, y, z, accuracy);
set_sensor_tilt(tmp, strlen(tmp));
memset(tmp, 0, sizeof(tmp));
- sprintf(tmp, "%d %d %d %d", x, y, z, accuracy);
+ snprintf(tmp, sizeof(tmp), "%d %d %d %d", x, y, z, accuracy);
set_sensor_tilt(tmp, strlen(tmp));
}
memset(tmp, 0, sizeof(tmp));
- sprintf(tmp, "%d %d %d", x, y, z);
+ snprintf(tmp, sizeof(tmp), "%d %d %d", x, y, z);
set_sensor_mag(tmp, strlen(tmp));
}
// should we compare stdout(fd/1) and stderr(fd/2) ??
#if defined(CONFIG_LINUX)
result = readlink("/proc/self/fd/1", log_filename, PATH_MAX);
- if (result >= 0) {
+ if (result >= 0 && result < PATH_MAX) {
log_filename[result] = '\0';
}
#elif defined(CONFIG_DARWIN)
QTAILQ_FOREACH(var, &variables, entry) {
if (!g_strcmp0(name, var->name)) {
- if(!override)
+ if(!override) {
+ g_free(value);
+ g_free(name);
return;
+ }
g_free(name);
g_free(var->value);
if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
fprintf(stderr,
"Profile configuration file [%s] is invalid.\n", filename);
+ g_free(filename);
return false;
}
file = g_fopen(filename, "r");
{
char tmp[255] = {0};
- sprintf(tmp, "%d\n%d\n%lf\n%lf\n%lf\n",
+ snprintf(tmp, sizeof(tmp), "%d\n%d\n%lf\n%lf\n%lf\n",
level_accel, 3, (atof(data->x) * ACCEL_ADJUST),
(atof(data->y) * ACCEL_ADJUST), (atof(data->z) * ACCEL_ADJUST));
send_eventcast_sensor_data(tmp, strlen(tmp));
int num_profiles = _vaMaxNumProfiles(va_ctx->display);
VAProfile *profiles_list = g_malloc0_n(num_profiles, sizeof(VAProfile));
- bool is_supported_profile;
+ bool is_supported_profile = false;
int i;
if (!profiles_list) {
error:
cleanup(va_ctx);
- g_free(va_ctx);
return NULL;
}
info->system = g_current_tune.system;
info->country = g_current_tune.country;
info->playmode = g_current_tune.playmode;
- strcpy(info->map_table_path, ts_mapping_table_path);
+ strncpy(info->map_table_path, ts_mapping_table_path, sizeof(info->map_table_path));
return info->is_tuned? 0 : -1;
}
char data[TUNER_DATA_SIZE];
char cmd[10] = {0};
- strcpy(cmd, "TUNER_DTV");
+ strncpy(cmd, "TUNER_DTV", sizeof(cmd));
if (strlen(g_current_tune.map_table_path) < MAX_PATH_LEN) {
- sprintf(data, "%d:%d:%d:%d:%d:%d:%s",
+ snprintf(data, sizeof(data), "%d:%d:%d:%d:%d:%d:%s",
g_current_tune.is_streaming, g_current_tune.frequency,
g_current_tune.modulation, g_current_tune.system,
g_current_tune.country, g_current_tune. playmode,
}
// There is no data to copy into guest.
- virtqueue_push(vesm->vq, elem, 0);
+ if(elem != NULL) {
+ virtqueue_push(vesm->vq, elem, 0);
+ }
virtio_notify(&vesm->vdev, vesm->vq);
}
_msg->info.client_type = type;
qemu_mutex_lock(&recv_buf_mutex);
- strcpy(nfc_data, data);
+ strncpy(nfc_data, data, sizeof(nfc_data));
QTAILQ_INSERT_TAIL(&nfc_recv_msg_queue, _msg, next);
qemu_mutex_unlock(&recv_buf_mutex);
switch (type) {
case sensor_type_accel:
qemu_mutex_lock(&accel_mutex);
- strcpy(accel_xyz, data);
+ strncpy(accel_xyz, data, sizeof(accel_xyz));
qemu_mutex_unlock(&accel_mutex);
break;
case sensor_type_accel_enable:
break;
case sensor_type_rotation_vector:
qemu_mutex_lock(&rot_mutex);
- strcpy(rot_quad, data);
+ strncpy(rot_quad, data, sizeof(rot_quad));
qemu_mutex_unlock(&rot_mutex);
break;
case sensor_type_rotation_vector_enable:
break;
case sensor_type_mag:
qemu_mutex_lock(&geo_mutex);
- strcpy(geo_tesla, data);
+ strncpy(geo_tesla, data, sizeof(geo_tesla));
qemu_mutex_unlock(&geo_mutex);
break;
case sensor_type_tilt:
qemu_mutex_lock(&geo_mutex);
- strcpy(geo_raw, data);
+ strncpy(geo_raw, data, sizeof(geo_raw));
qemu_mutex_unlock(&geo_mutex);
break;
case sensor_type_geo_enable:
break;
case sensor_type_pressure:
qemu_mutex_lock(&pressure_mutex);
- strcpy(pressure_data, data);
+ strncpy(pressure_data, data, sizeof(pressure_data));
qemu_mutex_unlock(&pressure_mutex);
break;
case sensor_type_pressure_enable:
/* Get a queue buffer which is written by guest side. */
elem = virtqueue_pop(vt->vq, sizeof(VirtQueueElement));
+ if (!elem) {
+ return;
+ }
qemu_mutex_lock(&vt->mutex);
while (!QTAILQ_EMPTY(&events_queue)) {
/* to be enable to drop events */
setAcceptDrops(true);
+
+
+ mFuncs = NULL;
+ mVAO = NULL;
+ mVBO = NULL;
}
void DisplayGLWidget::changedTexture(struct dpy_item *item)
this->prevY = 0;
this->mouseStatus = MOUSE_LEAVE;
this->lastMouseTime.tv_sec = 0;
+
+ this->tv.tv_sec = 0;
+ this->tv.tv_usec = 0;
}
void *MouseHelper::getParent()
ControllerForm::ControllerForm(const QString &name) : LayoutForm(name)
{
- /* do nothing */
+ rowCount = -1;
}
void ControllerForm::setCenteralRect(const QRect &rect)
this->win = ((MainWindow *)parent);
this->grabWinPos = SKINVIEW_NULLITY_POSITION;
this->kbdHelper = new KeyboardHelper(this);
+
+ bezelItem = NULL;
}
/* override */
getFloatingCon()->show();
} else {
- getDockingCon()->show(); /* updateGeometry */
+ DockingController* dockingCon = getDockingCon();
+ if (dockingCon != NULL) {
+ dockingCon->show(); /* updateGeometry */
+ }
}
/* Some part of QGLWidget's surface might be lost on Windows when view changing.
this->type = type;
this->name = name;
this->action = NULL;
+
+ slot = NULL;
}
int MenuItem::getType()
this->progressing = false;
connect(this, SIGNAL(geometryChanged(QRect)), this, SLOT(handleGeometryChanged(QRect)));
+
+ progressBar = NULL;
+ process = NULL;
}
bool SdbHelper::isSdbReady()
{
this->parent = parent;
connect(this, SIGNAL(errorOccured(QString, int)), this, SLOT(handleErrorOccured(QString, int)));
+
+ process = NULL;
+ command = -1;
}
void SdbHelperThread::setArguments(int command, QString &program, QList<QStringList> &args)
this->resolution = QSize(0, 0);
this->vmDataPath = "./";
this->skinPath = "./";
+
+ mainView = NULL;
}
void UiInformation::setVmName(QString name) { vmName = name; }
, file);
opts = qemu_opts_parse_noisily(&qemu_drive_opts, cmdline, false);
g_free(cmdline);
-
+ if (!opts) {
+ goto fail_attach;
+ }
qdict = qemu_opts_to_qdict(opts, NULL);
qemu_opts_del(opts);
char data[MAX_PKG_LIST + MAX_PATH_PKG_LIST];
memset(data, 0, sizeof(data));
- sprintf(data, "%s, %s", addon, pkgs);
+ snprintf(data, sizeof(data), "%s, %s", addon, pkgs);
data_len = strlen(data) + 1;
int sndlen = 14 + data_len;
LOG_TRACE("sndbuf data: %s\n", sndbuf + 14);
ret = send_to_evdi(route_ij, sndbuf, sndlen);
- if (ret < 0) {
- LOG_SEVERE("Failed to send emuld message\n");
- }
+ LOG_TRACE("send_to_evdi return value: %d\n", ret);
}
#ifdef CONFIG_WIN32
memset(addon, 0, sizeof(addon));
memset(pkgs, 0, sizeof(pkgs));
- strcpy(addon, dir_entry->d_name);
+ strncpy(addon, dir_entry->d_name, sizeof(addon));
#ifndef CONFIG_WIN32
- sprintf(sub_addon_path, "%s/%s", addon_path, dir_entry->d_name);
+ snprintf(sub_addon_path, sizeof(sub_addon_path), "%s/%s", addon_path, dir_entry->d_name);
#else
- sprintf(sub_addon_path, "%s\\%s", addon_path, dir_entry->d_name);
+ snprintf(sub_addon_path, sizeof(sub_addon_path), "%s\\%s", addon_path, dir_entry->d_name);
#endif
sub_dir = opendir(sub_addon_path);
if (!sub_dir) {
{
LOG_INFO("list id: %s\n", list->id);
if (list->attached) {
- hds_size = sprintf(hds, "%s,%s,%s,%d,\n", list->id, list->host, list->guest, list->level);
+ hds_size = snprintf(hds, sizeof(hds), "%s,%s,%s,%d,\n", list->id, list->host, list->guest, list->level);
if (strlen(list_hds) + hds_size > list_len) {
list_len *= 2;
list_hds = g_realloc(list_hds, list_len);
serial_len = strlen(client->serial);
// send message "[4 digit message length]host:sync:emulator-26101:[0|1]"
- sprintf(buf, "%04xhost:sync:%s:%01d", (serial_len + 12), client->serial, state);
+ snprintf(buf, sizeof(buf), "%04xhost:sync:%s:%01d", (serial_len + 12), client->serial, state);
LOG_INFO("send %s to client %s\n", buf, inet_ntoa(client->addr.sin_addr));
memcpy(&client->addr, addr, sizeof(struct sockaddr_in));
client->port = port;
- strcpy(client->serial, serial);
+ strncpy(client->serial, serial, sizeof(client->serial));
qemu_mutex_lock(&mutex_clients);
qemu_mutex_lock(&mutex_request);
if (get_platform_default_home()) {
+ qemu_mutex_unlock(&mutex_request);
return NULL;
}
#ifndef CONFIG_WIN32
if (fp == NULL) {
LOG_WARNING("Failed to run command\n");
g_free(cmd_root_off);
+ cmd_root_off = NULL;
break;
}
- g_free(cmd_root_off);
+ if (cmd_root_off != NULL) {
+ g_free(cmd_root_off);
+ }
pclose(fp);
fp = popen(cmd_get_home, "r");
if (ret < 0) {
LOG_INFO("failed to create UDP server\n");
close_server();
+ g_free(server);
+ server = NULL;
return;
}
struct ifreq ifr;
char dname[128];
int cause;
-
- ifname[0] = '\0';
+ if (ifname != NULL) {
+ ifname[0] = '\0';
+ }
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;