Changeset 128050 in webkit


Ignore:
Timestamp:
Sep 10, 2012 6:06:30 AM (12 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Sanitize the suggested filename when building the download destination URI
https://bugs.webkit.org/show_bug.cgi?id=96260

Reviewed by Gustavo Noronha Silva.

The suggested filename returned by the server can contain
directory separators so that the filename would be interpreted as
a full path.

  • UIProcess/API/gtk/WebKitDownload.cpp:

(webkitDownloadDecideDestination): Convert any directory separator
contained in the suggested filename to an underscore.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r128045 r128050  
     12012-09-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Sanitize the suggested filename when building the download destination URI
     4        https://bugs.webkit.org/show_bug.cgi?id=96260
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        The suggested filename returned by the server can contain
     9        directory separators so that the filename would be interpreted as
     10        a full path.
     11
     12        * UIProcess/API/gtk/WebKitDownload.cpp:
     13        (webkitDownloadDecideDestination): Convert any directory separator
     14        contained in the suggested filename to an underscore.
     15
    1162012-09-10  Simon Hausmann  <simon.hausmann@nokia.com>
    217
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp

    r119493 r128050  
    9999    if (!download->priv->destinationURI.isNull())
    100100        return FALSE;
    101     GOwnPtr<char> destination(g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD), suggestedFilename, NULL));
     101
     102    GOwnPtr<char> filename(g_strdelimit(g_strdup(suggestedFilename), G_DIR_SEPARATOR_S, '_'));
     103    GOwnPtr<char> destination(g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD), filename.get(), NULL));
    102104    GOwnPtr<char> destinationURI(g_filename_to_uri(destination.get(), 0, 0));
    103105    download->priv->destinationURI = destinationURI.get();
Note: See TracChangeset for help on using the changeset viewer.