mirror of
https://github.com/ISpillMyDrink/OpenSuperClone.git
synced 2026-08-24 20:16:31 +00:00
Fix type mismatch, strncpy truncation, and off-by-one error in usb error prints
This commit is contained in:
@@ -597,7 +597,7 @@ int print_gui_error_message_ccc(char *message, char *title, int type)
|
||||
{
|
||||
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
GtkWidget *dialog;
|
||||
GtkDialogFlags message_type;
|
||||
GtkMessageType message_type;
|
||||
if (type)
|
||||
{
|
||||
message_type = GTK_MESSAGE_WARNING;
|
||||
|
||||
@@ -13570,8 +13570,8 @@ int process_source_ccc(void)
|
||||
raw_alignment[0] = '\0';
|
||||
sscanf(line, "%s %s %s %s %s %[^\n]", name, raw_size, raw_bytes_per_log_sec, raw_bytes_per_phy_sec, raw_alignment, model);
|
||||
fprintf(stdout, "model=%s\n", model);
|
||||
strncpy(current_model_ccc, model, sizeof(current_model_ccc));
|
||||
strncpy(current_source_model_ccc, model, sizeof(current_source_model_ccc));
|
||||
strncpy(current_model_ccc, model, sizeof(current_model_ccc) - 1);
|
||||
strncpy(current_source_model_ccc, model, sizeof(current_source_model_ccc) - 1);
|
||||
// get device info
|
||||
long long size = strtoull(raw_size, NULL, 0);
|
||||
long long bytes_per_log_sec = strtoull(raw_bytes_per_log_sec, NULL, 0);
|
||||
|
||||
@@ -68,7 +68,7 @@ int find_all_usb_devices_ccc(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stdout, "Error: Unnable to get vendor string %04x:%04x (%s)\n", usb_vendor_id_ccc[i], usb_product_id_ccc[i], strerror(errno));
|
||||
fprintf(stdout, "Error: Unnable to get vendor string %04x:%04x (%s)\n", usb_vendor_id_ccc[usb_device_count_ccc], usb_product_id_ccc[usb_device_count_ccc], strerror(errno));
|
||||
}
|
||||
|
||||
rval = usb_get_string_simple(dev_handle, dev->descriptor.iProduct, buffer, sizeof(buffer));
|
||||
@@ -78,7 +78,7 @@ int find_all_usb_devices_ccc(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stdout, "Error: Unable to get product string %04x:%04x (%s)\n", usb_vendor_id_ccc[i], usb_product_id_ccc[i], strerror(errno));
|
||||
fprintf(stdout, "Error: Unable to get product string %04x:%04x (%s)\n", usb_vendor_id_ccc[usb_device_count_ccc], usb_product_id_ccc[usb_device_count_ccc], strerror(errno));
|
||||
}
|
||||
|
||||
rval = usb_get_string_simple(dev_handle, dev->descriptor.iSerialNumber, buffer, sizeof(buffer));
|
||||
@@ -88,7 +88,7 @@ int find_all_usb_devices_ccc(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stdout, "Error: Unable to get serial string %04x:%04x (%s)\n", usb_vendor_id_ccc[i], usb_product_id_ccc[i], strerror(errno));
|
||||
fprintf(stdout, "Error: Unable to get serial string %04x:%04x (%s)\n", usb_vendor_id_ccc[usb_device_count_ccc], usb_product_id_ccc[usb_device_count_ccc], strerror(errno));
|
||||
}
|
||||
|
||||
// if the device is known to have an extra id or serial then get it
|
||||
@@ -110,7 +110,7 @@ int find_all_usb_devices_ccc(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stdout, "Failed to get special id %04x:%04x, %d (%s)\n", usb_vendor_id_ccc[i], usb_product_id_ccc[i], bytesreceived, strerror(errno));
|
||||
fprintf(stdout, "Failed to get special id %04x:%04x, %d (%s)\n", usb_vendor_id_ccc[usb_device_count_ccc], usb_product_id_ccc[usb_device_count_ccc], bytesreceived, strerror(errno));
|
||||
}
|
||||
// if it is a known usb relay then mark it
|
||||
usb_known_relay_ccc[usb_device_count_ccc] = 1;
|
||||
|
||||
Reference in New Issue
Block a user