[netspeed] Fix out-of-bounds access; Fixes #580683
- From: Jörgen Scheibengruber <mfcn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [netspeed] Fix out-of-bounds access; Fixes #580683
- Date: Sat, 5 Jun 2010 14:10:41 +0000 (UTC)
commit 225107e053e0a410e43d47daa7f5b0de0d635002
Author: Jörgen Scheibengruber <mfcn gmx de>
Date: Sat Jun 5 16:05:49 2010 +0300
Fix out-of-bounds access; Fixes #580683
src/netspeed.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/netspeed.c b/src/netspeed.c
index 8ce75aa..62e1061 100644
--- a/src/netspeed.c
+++ b/src/netspeed.c
@@ -465,18 +465,18 @@ redraw_graph(NetspeedApplet *applet)
/* calculate the polygons (GdkPoint[]) for the graphs */
offset = 0;
- for (i = applet->index_graph + 1; applet->in_graph[i] < 0; i = (i + 1) % GRAPH_VALUES)
+ for (i = (applet->index_graph + 1) % GRAPH_VALUES; applet->in_graph[i] < 0; i = (i + 1) % GRAPH_VALUES)
offset++;
for (i = offset + 1; i < GRAPH_VALUES; i++)
{
int index = (applet->index_graph + i) % GRAPH_VALUES;
- out_points[i].x = in_points[i].x = ((w - 8) * i) / GRAPH_VALUES + 2;
+ out_points[i].x = in_points[i].x = ((w - 6) * i) / GRAPH_VALUES + 4;
in_points[i].y = h - 6 - (int)((h - 8) * applet->in_graph[index] / max_val);
out_points[i].y = h - 6 - (int)((h - 8) * applet->out_graph[index] / max_val);
}
- in_points[offset].x = out_points[offset].x = ((w - 8) * offset) / GRAPH_VALUES + 2;
- in_points[offset].y = in_points[offset + 1].y;
- out_points[offset].y = out_points[offset + 1].y;
+ in_points[offset].x = out_points[offset].x = ((w - 6) * offset) / GRAPH_VALUES + 4;
+ in_points[offset].y = in_points[(offset + 1) % GRAPH_VALUES].y;
+ out_points[offset].y = out_points[(offset + 1) % GRAPH_VALUES].y;
/* draw the background */
gdk_gc_set_rgb_fg_color (gc, &da->style->black);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]