diff options
author | Davyd Madeley <davyd@madeley.id.au> | 2006-07-31 14:44:34 +0000 |
---|---|---|
committer | Davyd Madeley <davyd@src.gnome.org> | 2006-07-31 14:44:34 +0000 |
commit | c2f6d020bd2d805462cdd42c409bdce27cb5d0b9 (patch) | |
tree | 9bc2fa6bdf0d481816cd0b438de1195dd4794e73 | |
parent | c7ba689e37d960d52f5234a996e92b506cff8455 (diff) |
fix bom_parse against unexpected input. Patch from Kevin Bauder
2006-07-31 Davyd Madeley <davyd@madeley.id.au>
* weather-bom.c: fix bom_parse against unexpected input. Patch from
Kevin Bauder <kevin.bauder@gmail.com>. Part of bug #170628.
-rw-r--r-- | libgweather/ChangeLog | 5 | ||||
-rw-r--r-- | libgweather/weather-bom.c | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libgweather/ChangeLog b/libgweather/ChangeLog index 96ee2c78e..1a85aa912 100644 --- a/libgweather/ChangeLog +++ b/libgweather/ChangeLog @@ -1,3 +1,8 @@ +2006-07-31 Davyd Madeley <davyd@madeley.id.au> + + * weather-bom.c: fix bom_parse against unexpected input. Patch from + Kevin Bauder <kevin.bauder@gmail.com>. Part of bug #170628. + 2006-01-31 Davyd Madeley <davyd@madeley.id.au> * weather.c: replace sscanf with g_strsplit to prevent stack smashing. diff --git a/libgweather/weather-bom.c b/libgweather/weather-bom.c index ef961713c..489196371 100644 --- a/libgweather/weather-bom.c +++ b/libgweather/weather-bom.c @@ -21,10 +21,16 @@ static gchar *bom_parse (gchar *meto) { gchar *p, *rp; - + + g_return_val_if_fail (meto != NULL, NULL); + p = strstr(meto, "<pre>"); - p += 5; /* skip the <pre> */ + g_return_val_if_fail (p != NULL, NULL); + rp = strstr(p, "</pre>"); + g_return_val_if_fail (rp !=NULL, NULL); + + p += 5; /* skip the <pre> */ return g_strndup(p, rp-p); } |