Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at filesystem.c:1522

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

file_save_as_ok_cb

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/capture_file_dlg.c)expand/collapse
Show more  
 1378  file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) {
 1379    gchar *cf_name;
 1380    gpointer  dialog;
 1381   
 1382    cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs)));
 1383   
 1384    /* Perhaps the user specified a directory instead of a file.
 1385       Check whether they did. */
 1386[+]   if (test_for_directory(cf_name) == EISDIR) {
 1387          /* It's a directory - set the file selection box to display that
 1388             directory, and leave the selection box displayed. */
 1389          set_last_open_dir(cf_name);
 1390          g_free(cf_name);
 1391          file_selection_set_current_folder(fs, get_last_open_dir());
 1392          return;
 1393    }
 1394   
 1395    /* Check whether the range is valid. */
 1396[+]   if (!range_check_validity(&range)) {
 1397      /* The range isn't valid; don't dismiss the open dialog box,
 1398         just leave it around so that the user can, after they
 1399         dismiss the alert box popped up for the error, try again. */
 1400      g_free(cf_name);
 1401      /* XXX - as we cannot start a new event loop (using gtk_dialog_run()),
 1402       * as this will prevent the user from closing the now existing error
 1403       * message, simply close the dialog (this is the best we can do here). */
 1404      if (file_save_as_w)
 1405        window_destroy(GTK_WIDGET (fs));
 1406   
 1407      return;
 1408    }
 1409   
 1410    /*
 1411     * Check that the from file is not the same as to file
 1412     * We do it here so we catch all cases ...
 1413     * Unfortunately, the file requester gives us an absolute file
 1414     * name and the read file name may be relative (if supplied on
 1415     * the command line). From Joerg Mayer.
 1416     */
 1417[+]   if (files_identical(cfile.filename, cf_name)) {
 1418      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 1419        "%sCapture file: \"%s\" identical to loaded file!%s\n\n"
 1420        "Please choose a different filename.",
 1421        simple_dialog_primary_start(), cf_name, simple_dialog_primary_end());
 1422      g_free(cf_name);
 1423      /* XXX - as we cannot start a new event loop (using gtk_dialog_run()),
 1424       * as this will prevent the user from closing the now existing error
 1425       * message, simply close the dialog (this is the best we can do here). */
 1426      if (file_save_as_w)
 1427        window_destroy(GTK_WIDGET (fs));
 1428   
 1429      return;
 1430    }
 1431   
 1432    /* don't show the dialog while saving (or asking) */
 1433    gtk_widget_hide(GTK_WIDGET (fs));
 1434   
 1435    /* it the file doesn't exist, simply try to save it */
 1436[+]   if (!file_exists(cf_name)) {
expand/collapse

file_exists

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/filesystem.c)expand/collapse
Show more  
 1503  file_exists(const char *fname)
 1504  {
 1505          struct stat   file_stat;
 1506   
 1507  #ifdef _WIN32 
 1508          /*
 1509           * This is a bit tricky on win32. The st_ino field is documented as:
 1510           * "The inode, and therefore st_ino, has no meaning in the FAT, ..."
 1511           * but it *is* set to zero if stat() returns without an error,
 1512           * so this is working, but maybe not quite the way expected. ULFL 
 1513           */
 1514          file_stat.st_ino = 1;   /* this will make things work if an error occured */
 1515          ws_stat(fname, &file_stat);
 1516          if (file_stat.st_ino == 0) {
 1517                  return TRUE;
 1518          } else {
 1519                  return FALSE;
 1520          }
 1521  #else
 1522          if (ws_stat(fname, &file_stat) != 0 && errno == ENOENT) {
Show more  
Show more  




Change Warning 3982.32772 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: