diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index e0ff133ee2..dce6e8175f 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -165,7 +165,7 @@ static bool android_input_lookup_name_prekitkat(char *buf, jmethodID method, getName; jobject device, name; const char *str = NULL; - JNIEnv *env = (JNIEnv*)jni_thread_getenv(); + JNIEnv *env = (JNIEnv*)jni_thread_getenv(); if (!env) goto error; @@ -225,7 +225,7 @@ static bool android_input_lookup_name(char *buf, jmethodID method, getName, getVendorId, getProductId; jobject device, name; const char *str = NULL; - JNIEnv *env = (JNIEnv*)jni_thread_getenv(); + JNIEnv *env = (JNIEnv*)jni_thread_getenv(); if (!env) goto error; @@ -566,11 +566,12 @@ static void handle_hotplug(android_input_t *android, struct android_app *android_app, unsigned *port, unsigned id, int source) { - char device_name[256], name_buf[256]; + char device_name[256] = {0}; + char name_buf[256] = {0}; + autoconfig_params_t params = {{0}}; name_buf[0] = device_name[0] = 0; - int vendorId = 0, productId = 0; - autoconfig_params_t params = {{0}}; - settings_t *settings = config_get_ptr(); + int vendorId = 0, productId = 0; + settings_t *settings = config_get_ptr(); if (!settings->input.autodetect_enable) return; diff --git a/input/drivers/qnx_input.c b/input/drivers/qnx_input.c index 402b038a70..9e934575cb 100644 --- a/input/drivers/qnx_input.c +++ b/input/drivers/qnx_input.c @@ -166,7 +166,7 @@ static void qnx_process_gamepad_event( static void qnx_input_autodetect_gamepad(qnx_input_t *qnx, qnx_input_device_t* controller, int port) { - char name_buf[256]; + char name_buf[256] = {0}; settings_t *settings = config_get_ptr(); if (!qnx) diff --git a/input/drivers_joypad/dinput_joypad.c b/input/drivers_joypad/dinput_joypad.c index 286fef4b11..045cf70a6d 100644 --- a/input/drivers_joypad/dinput_joypad.c +++ b/input/drivers_joypad/dinput_joypad.c @@ -139,9 +139,9 @@ static bool guid_is_xinput_device(const GUID* product_guid) for (i = 0; i < num_raw_devs; i++) { RID_DEVICE_INFO rdi; - char devName[128]; - UINT rdiSize = sizeof(rdi); - UINT nameSize = sizeof(devName); + char devName[128] = {0}; + UINT rdiSize = sizeof(rdi); + UINT nameSize = sizeof(devName); rdi.cbSize = sizeof (rdi); diff --git a/input/drivers_joypad/linuxraw_joypad.c b/input/drivers_joypad/linuxraw_joypad.c index b81f14643e..5467fdf5ea 100644 --- a/input/drivers_joypad/linuxraw_joypad.c +++ b/input/drivers_joypad/linuxraw_joypad.c @@ -95,7 +95,8 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p if (g_hotplug) { - char msg[512]; + char msg[512] = {0}; + snprintf(msg, sizeof(msg), "Device #%u (%s) connected.", (unsigned)(pad - linuxraw_pads), pad->ident); rarch_main_msg_queue_push(msg, 0, 60, false); } @@ -166,7 +167,7 @@ static void handle_plugged_pad(void) else if (event->mask & (IN_CREATE | IN_ATTRIB)) { bool ret; - char path[PATH_MAX_LENGTH]; + char path[PATH_MAX_LENGTH] = {0}; snprintf(path, sizeof(path), "/dev/input/%s", event->name); ret = linuxraw_joypad_init_pad(path, &linuxraw_pads[idx]); @@ -224,7 +225,7 @@ static bool linuxraw_joypad_init(void *data) for (i = 0; i < MAX_USERS; i++) { - char path[PATH_MAX_LENGTH]; + char path[PATH_MAX_LENGTH] = {0}; autoconfig_params_t params = {{0}}; struct linuxraw_joypad *pad = (struct linuxraw_joypad*)&linuxraw_pads[i]; diff --git a/input/drivers_joypad/parport_joypad.c b/input/drivers_joypad/parport_joypad.c index 3a8f4018b5..93a5a16bd4 100644 --- a/input/drivers_joypad/parport_joypad.c +++ b/input/drivers_joypad/parport_joypad.c @@ -226,12 +226,12 @@ static void parport_free_pad(struct parport_joypad *pad) static bool parport_joypad_init(void *data) { unsigned i, j; - bool found_enabled_button; - bool found_disabled_button; - char buf[PARPORT_NUM_BUTTONS * 3 + 1]; - char pin[3 + 1]; - settings_t *settings = config_get_ptr(); - autoconfig_params_t params = {{0}}; + bool found_enabled_button = false; + bool found_disabled_button = false; + char buf[PARPORT_NUM_BUTTONS * 3 + 1] = {0}; + char pin[3 + 1] = {0}; + settings_t *settings = config_get_ptr(); + autoconfig_params_t params = {{0}}; (void)data; @@ -239,7 +239,7 @@ static bool parport_joypad_init(void *data) for (i = 0; i < MAX_USERS; i++) { - char path[PATH_MAX_LENGTH]; + char path[PATH_MAX_LENGTH] = {0}; struct parport_joypad *pad = &parport_pads[i]; pad->fd = -1; @@ -309,7 +309,7 @@ static bool parport_joypad_init(void *data) static void parport_joypad_destroy(void) { unsigned i; - struct parport_joypad *pad; + struct parport_joypad *pad = NULL; for (i = 0; i < MAX_USERS; i++) { diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index d942d93fed..ca534a769b 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -204,10 +204,10 @@ error: static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char *path) { - int ret = 0; int i; - const char *buf; struct stat st; + int ret = 0; + const char *buf = NULL; unsigned buttons = 0; unsigned axes = 0; struct udev_device *parent = NULL; @@ -351,7 +351,8 @@ static void udev_check_device(struct udev_device *dev, const char *path, bool ho default: if (hotplugged) { - char msg[PATH_MAX_LENGTH]; + char msg[PATH_MAX_LENGTH] = {0}; + snprintf(msg, sizeof(msg), "Device #%u (%s) connected.", pad, path); rarch_main_msg_queue_push(msg, 0, 60, false); RARCH_LOG("[udev]: %s\n", msg);