[Openvas-commits] r1328 - in trunk/openvas-client: . nessus
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Sep 11 01:44:59 CEST 2008
Author: timb
Date: 2008-09-11 01:44:50 +0200 (Thu, 11 Sep 2008)
New Revision: 1328
Modified:
trunk/openvas-client/ChangeLog
trunk/openvas-client/nessus/monitor_dialog.c
Log:
Fixed #758, which leads to an OpenVAS client crash due to a divide by zero
Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog 2008-09-10 15:51:23 UTC (rev 1327)
+++ trunk/openvas-client/ChangeLog 2008-09-10 23:44:50 UTC (rev 1328)
@@ -1,3 +1,8 @@
+2008-09-11 Tim Brown <timb at nth-dimension.org.uk>
+
+ * nessus/monitor_dialog.c: Fixed #758, which leads to an OpenVAS client
+ crash due to a divide by zero.
+
2008-09-10 Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
* nessus/nessus_plugin.h (struct nessus_plugin): Finally remove
Modified: trunk/openvas-client/nessus/monitor_dialog.c
===================================================================
--- trunk/openvas-client/nessus/monitor_dialog.c 2008-09-10 15:51:23 UTC (rev 1327)
+++ trunk/openvas-client/nessus/monitor_dialog.c 2008-09-10 23:44:50 UTC (rev 1328)
@@ -376,9 +376,14 @@
if (GTK_CHECK_VERSION(2,6,0)) { /* TreeView since GTK 2.6 */
GtkListStore * store = arg_get_value(ctrls, "MON_STORE");
GtkTreeIter iter;
- int f = (atoi(current) * 100) / max;
- if(f>=100)f=100;
- if(f<=0)f=0;
+ int f;
+ if (max == 0) {
+ f = 100;
+ } else {
+ f = (atoi(current) / max) * 100;
+ if(f>=100)f=100;
+ if(f<=0)f=0;
+ }
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
do {
@@ -415,16 +420,21 @@
GtkWidget * progress_bar;
gfloat f;
+ gmax = max;
+ if (gmax == 0) {
+ f = 1.0;
+ } else {
+ gcurrent = atoi(current);
+ f = (gcurrent/gmax);
+ if(f>=1.0)f=1.0;
+ if(f<=0.0)f=0.0;
+ }
+
if( strcmp(action, "portscan") == 0 )
progress_bar = gtk_object_get_data(item, "progress_bar_portscan");
else
progress_bar = gtk_object_get_data(item, "progress_bar_attack");
- gmax = max;
- gcurrent = atoi(current);
- f = (gcurrent/gmax);
- if(f>=1.0)f=1.0;
- if(f<=0.0)f=0.0;
gtk_progress_bar_update (GTK_PROGRESS_BAR(progress_bar), f);
flag = 1;
More information about the Openvas-commits
mailing list