Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at main_proto_draw.c:892

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

savehex_save_clicked_cb

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/main_proto_draw.c)expand/collapse
Show more  
 842  savehex_save_clicked_cb(GtkWidget * w _U_, gpointer data _U_)
 843  {
 844          GtkWidget *bv;
 845          int fd, start, end;
 846          guint len;
 847          const guint8 *data_p = NULL;
 848          char *file;
 849   
 850          file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(savehex_dlg));
 851   
 852  #if 0 /* Not req'd: GtkFileChooserWidget currently being used won't return with a Null filename */
 853          if (!file ||! *file) {
 854                  simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Please enter a filename!");
 855                  g_free(file);
 856                  return TRUE;
 857          }
 858  #endif
 859[+]         if (test_for_directory(file) == EISDIR) {
 860                  /* It's a directory - set the file selection box to display that
 861                     directory, and leave the selection box displayed. */
 862                  set_last_open_dir(file);
 863                  g_free(file);
 864                  file_selection_set_current_folder(savehex_dlg, get_last_open_dir());
 865                  gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(savehex_dlg), "");
 866                  return FALSE; /* do gtk_dialog_run again */
 867          }
 868   
 869          /* XXX: Must check if file name exists first */
 870   
 871[+]         bv = get_notebook_bv_ptr(byte_nb_ptr);
 872          if (bv == NULL) {
 873                  /* shouldn't happen */
 874                  simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not find the corresponding text window!");
 875                  g_free(file);
 876                  return TRUE;
 877          }
 878          /*
 879           * Retrieve the info we need 
 880           */
 881          end = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_START_KEY));
 882          start = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_END_KEY));
 883[+]         data_p = get_byte_view_data_and_length(bv, &len);
 884   
 885          if (data_p == NULL || start == -1 || start > end) {
 886                  simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 887                      "No data selected to save!");
 888                  g_free(file);
 889                  return TRUE;
 890          }
 891   
 892          fd = ws_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
Show more  




Change Warning 4187.31330 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: