diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-02-04 09:05:50 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-02-04 09:05:50 +0000 |
| commit | bceaaf6eacb0bf2f23cf42af5d9ee8332a08560f (patch) | |
| tree | 05cbfa9a23814f2a4f62f25e0bf78bf13c2b23bc /src/extension/internal/gimpgrad.cpp | |
| parent | Documentation: sp-filter.h is not documented at all, removing fake explanation. (diff) | |
| download | inkscape-bceaaf6eacb0bf2f23cf42af5d9ee8332a08560f.tar.gz inkscape-bceaaf6eacb0bf2f23cf42af5d9ee8332a08560f.zip | |
cppcheck tells us: scanf without field width limits can crash with huge input data. (gimpgrad)
Some additional scanf modifications
(bzr r10932)
Diffstat (limited to 'src/extension/internal/gimpgrad.cpp')
| -rw-r--r-- | src/extension/internal/gimpgrad.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp index e92a4e17e..a9a31fe84 100644 --- a/src/extension/internal/gimpgrad.cpp +++ b/src/extension/internal/gimpgrad.cpp @@ -31,12 +31,11 @@ namespace Extension { namespace Internal { /** - \brief A function to allocated anything -- just an example here + \brief A function to allocate anything -- just an example here \param module Unused \return Whether the load was sucessful */ -bool -GimpGrad::load (Inkscape::Extension::Extension */*module*/) +bool GimpGrad::load (Inkscape::Extension::Extension */*module*/) { // std::cout << "Hey, I'm loading!\n" << std::endl; return TRUE; @@ -47,15 +46,13 @@ GimpGrad::load (Inkscape::Extension::Extension */*module*/) \param module Unused \return None */ -void -GimpGrad::unload (Inkscape::Extension::Extension */*module*/) +void GimpGrad::unload (Inkscape::Extension::Extension */*module*/) { // std::cout << "Nooo! I'm being unloaded!" << std::endl; return; } -static void -append_css_num(Glib::ustring &str, double const num) +static void append_css_num(Glib::ustring &str, double const num) { CSSOStringStream stream; stream << num; @@ -74,8 +71,7 @@ append_css_num(Glib::ustring &str, double const num) hex values from 0 to 255 for color. Otherwise mostly this is just turning the values into strings and returning it. */ -static Glib::ustring -stop_svg(ColorRGBA const in_color, double const location) +static Glib::ustring stop_svg(ColorRGBA const in_color, double const location) { Glib::ustring ret("<stop stop-color=\""); @@ -226,7 +222,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) * add some intermediate stops to convert to the linear/sRGB interpolation */ int type; /* enum: linear, curved, sine, sphere increasing, sphere decreasing. */ int color_interpolation; /* enum: rgb, hsv anticlockwise, hsv clockwise. */ - if (sscanf(p, "%d %d", &type, &color_interpolation) != 2) { + if (sscanf(p, "%.8d %.8d", &type, &color_interpolation) != 2) { continue; } } @@ -267,8 +263,7 @@ error: #include "clear-n_.h" -void -GimpGrad::init (void) +void GimpGrad::init (void) { Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" |
