diff -urN ../xsane-0.995-orig/src/xsane-batch-scan.c src/xsane-batch-scan.c --- ../xsane-0.995-orig/src/xsane-batch-scan.c 2007-03-13 06:42:38 +0900 +++ src/xsane-batch-scan.c 2007-12-26 06:13:52 +0900 @@ -342,7 +342,7 @@ xsane_set_sensitivity(FALSE); - sprintf(windowname, "%s %s %s", xsane.prog_name, WINDOW_LOAD_BATCH_LIST, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_LOAD_BATCH_LIST, xsane.device_text); xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", "batch-lists", 0, "default", ".xbl", XSANE_PATH_LOCAL_SANE); if (!xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, NULL, XSANE_FILE_CHOOSER_ACTION_OPEN, XSANE_GET_FILENAME_SHOW_NOTHING, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_BATCHLIST, XSANE_FILE_FILTER_BATCHLIST)) @@ -393,7 +393,7 @@ xsane_set_sensitivity(FALSE); - sprintf(windowname, "%s %s %s", xsane.prog_name, WINDOW_SAVE_BATCH_LIST, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_SAVE_BATCH_LIST, xsane.device_text); xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", "batch-lists", 0, "default", ".xbl", XSANE_PATH_LOCAL_SANE); if (!xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, NULL, XSANE_FILE_CHOOSER_ACTION_SAVE, XSANE_GET_FILENAME_SHOW_NOTHING, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_BATCHLIST, XSANE_FILE_FILTER_BATCHLIST)); diff -urN ../xsane-0.995-orig/src/xsane-device-preferences.c src/xsane-device-preferences.c --- ../xsane-0.995-orig/src/xsane-device-preferences.c 2007-03-04 08:34:40 +0900 +++ src/xsane-device-preferences.c 2007-12-26 06:13:52 +0900 @@ -640,7 +640,7 @@ xsane_set_sensitivity(FALSE); - sprintf(windowname, "%s %s %s", xsane.prog_name, WINDOW_LOAD_SETTINGS, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_LOAD_SETTINGS, xsane.device_text); xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc", XSANE_PATH_LOCAL_SANE); if (!xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, NULL, XSANE_FILE_CHOOSER_ACTION_OPEN, FALSE, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_DRC, XSANE_FILE_FILTER_DRC)) @@ -791,7 +791,7 @@ xsane_set_sensitivity(FALSE); - sprintf(windowname, "%s %s %s", xsane.prog_name, WINDOW_SAVE_SETTINGS, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_SAVE_SETTINGS, xsane.device_text); xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc", XSANE_PATH_LOCAL_SANE); if (!xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, NULL, XSANE_FILE_CHOOSER_ACTION_SAVE, FALSE, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_DRC, XSANE_FILE_FILTER_DRC)) diff -urN ../xsane-0.995-orig/src/xsane-front-gtk.c src/xsane-front-gtk.c --- ../xsane-0.995-orig/src/xsane-front-gtk.c 2007-05-17 22:35:06 +0900 +++ src/xsane-front-gtk.c 2007-12-26 06:13:52 +0900 @@ -1852,7 +1852,7 @@ xsane_set_sensitivity(FALSE); - sprintf(windowname, "%s %s %s", xsane.prog_name, WINDOW_CHANGE_WORKING_DIR, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_CHANGE_WORKING_DIR, xsane.device_text); if (getcwd(filename, sizeof(filename))) { /* xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, TRUE, FALSE, TRUE, FALSE); */ diff -urN ../xsane-0.995-orig/src/xsane-gamma.c src/xsane-gamma.c --- ../xsane-0.995-orig/src/xsane-gamma.c 2007-02-26 07:22:22 +0900 +++ src/xsane-gamma.c 2007-12-26 06:13:52 +0900 @@ -2196,7 +2196,7 @@ gtk_window_set_resizable(GTK_WINDOW(xsane.histogram_dialog), FALSE); gtk_window_move(GTK_WINDOW(xsane.histogram_dialog), XSANE_HISTOGRAM_DIALOG_POS_X, XSANE_HISTOGRAM_DIALOG_POS_Y); g_signal_connect(GTK_OBJECT(xsane.histogram_dialog), "delete_event", GTK_SIGNAL_FUNC(xsane_histogram_win_delete), NULL); - sprintf(windowname, "%s %s", WINDOW_HISTOGRAM, devicetext); + snprintf(windowname, sizeof(windowname), "%s %s", WINDOW_HISTOGRAM, devicetext); gtk_window_set_title(GTK_WINDOW(xsane.histogram_dialog), windowname); xsane_set_window_icon(xsane.histogram_dialog, 0); gtk_window_add_accel_group(GTK_WINDOW(xsane.histogram_dialog), xsane.accelerator_group); @@ -2517,7 +2517,7 @@ gtk_window_set_resizable(GTK_WINDOW(xsane.gamma_dialog), FALSE); gtk_window_move(GTK_WINDOW(xsane.gamma_dialog), XSANE_GAMMA_POS_X, XSANE_GAMMA_POS_Y); g_signal_connect(GTK_OBJECT(xsane.gamma_dialog), "delete_event", GTK_SIGNAL_FUNC(xsane_gamma_win_delete), NULL); - sprintf(windowname, "%s %s", WINDOW_GAMMA, devicetext); + snprintf(windowname, sizeof(windowname), "%s %s", WINDOW_GAMMA, devicetext); gtk_window_set_title(GTK_WINDOW(xsane.gamma_dialog), windowname); xsane_set_window_icon(xsane.gamma_dialog, 0); gtk_window_add_accel_group(GTK_WINDOW(xsane.gamma_dialog), xsane.accelerator_group); diff -urN ../xsane-0.995-orig/src/xsane-save.c src/xsane-save.c --- ../xsane-0.995-orig/src/xsane-save.c 2007-05-17 21:53:40 +0900 +++ src/xsane-save.c 2007-12-26 06:13:52 +0900 @@ -4684,7 +4684,7 @@ time(&now); ptm = localtime(&now); - sprintf(buf, "%04d:%02d:%02d %02d:%02d:%02d", 1900+ptm->tm_year, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); + snprintf(buf, sizeof(buf), "%04d:%02d:%02d %02d:%02d:%02d", 1900+ptm->tm_year, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); TIFFSetField(tiffile, TIFFTAG_DATETIME, buf); if (image_info->resolution_x > 0.0) diff -urN ../xsane-0.995-orig/src/xsane.c src/xsane.c --- ../xsane-0.995-orig/src/xsane.c 2007-09-29 00:24:56 +0900 +++ src/xsane.c 2007-12-26 06:13:52 +0900 @@ -4824,7 +4824,7 @@ { char msg[TEXTBUFSIZE]; - sprintf(msg, "%s %s: %s.", ERR_GET_OPTION, opt->name, XSANE_STRSTATUS(status)); + snprintf(msg, sizeof(msg), "%s %s: %s.", ERR_GET_OPTION, opt->name, XSANE_STRSTATUS(status)); xsane_back_gtk_error(msg, TRUE); } } @@ -4970,13 +4970,13 @@ if (!strncmp(devname, "net:", 4)) /* network device ? */ { - sprintf(textptr, "net:"); + snprintf(textptr, sizeof(devicetext)-(textptr-devicetext), "net:"); textptr = devicetext + strlen(devicetext); } snprintf(buf, sizeof(buf), ":%s", devname); snprintf(buf, sizeof(buf), "/%s", (strrchr(buf, ':')+1)); - sprintf(textptr, (strrchr(buf, '/')+1)); + snprintf(textptr, sizeof(devicetext)-(textptr-devicetext), (strrchr(buf, '/')+1)); xsane.device_text = strdup(devicetext); @@ -5005,7 +5005,7 @@ xsane.dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_move(GTK_WINDOW(xsane.dialog), XSANE_DIALOG_POS_X, XSANE_DIALOG_POS_Y); - sprintf(windowname, "%s %s %s", xsane.prog_name, XSANE_VERSION, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, XSANE_VERSION, xsane.device_text); gtk_window_set_title(GTK_WINDOW(xsane.dialog), (char *) windowname); g_signal_connect(GTK_OBJECT(xsane.dialog), "delete_event", GTK_SIGNAL_FUNC(xsane_scan_win_delete), NULL); @@ -5112,7 +5112,7 @@ xsane.standard_options_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_move(GTK_WINDOW(xsane.standard_options_dialog), XSANE_STD_OPTIONS_DIALOG_POS_X, XSANE_STD_OPTIONS_DIALOG_POS_Y); - sprintf(windowname, "%s %s", WINDOW_STANDARD_OPTIONS, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s", WINDOW_STANDARD_OPTIONS, xsane.device_text); gtk_window_set_title(GTK_WINDOW(xsane.standard_options_dialog), (char *) windowname); gtk_window_set_resizable(GTK_WINDOW(xsane.standard_options_dialog), FALSE); @@ -5139,7 +5139,7 @@ xsane.advanced_options_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_move(GTK_WINDOW(xsane.advanced_options_dialog), XSANE_ADV_OPTIONS_DIALOG_POS_X, XSANE_ADV_OPTIONS_DIALOG_POS_Y); - sprintf(windowname, "%s %s",WINDOW_ADVANCED_OPTIONS, xsane.device_text); + snprintf(windowname, sizeof(windowname), "%s %s",WINDOW_ADVANCED_OPTIONS, xsane.device_text); gtk_window_set_title(GTK_WINDOW(xsane.advanced_options_dialog), (char *) windowname); gtk_window_set_resizable(GTK_WINDOW(xsane.advanced_options_dialog), FALSE);