projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix up potential overflows in size calculations by replacing
[pspp]
/
src
/
factor_stats.c
diff --git
a/src/factor_stats.c
b/src/factor_stats.c
index 79c9b80ca8b2a4c2e9c46b5016377f348805f95c..29eebed2d5e6015f801724c450ab83f980c4e0a4 100644
(file)
--- a/
src/factor_stats.c
+++ b/
src/factor_stats.c
@@
-15,11
+15,11
@@
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 5
9 Temple Place - Suite 330
, Boston, MA
-0211
1-1307
, USA. */
+Foundation, Inc., 5
1 Franklin Street, Fifth Floor
, Boston, MA
+0211
0-1301
, USA. */
+#include <config.h>
#include "factor_stats.h"
#include "factor_stats.h"
-#include "config.h"
#include "val.h"
#include "hash.h"
#include "algorithm.h"
#include "val.h"
#include "hash.h"
#include "algorithm.h"
@@
-93,7
+93,7
@@
metrics_calc(struct metrics *fs, const union value *val,
assert( (*wv)->v.f == val->f );
(*wv)->w += weight;
assert( (*wv)->v.f == val->f );
(*wv)->w += weight;
- cn = xmalloc
( sizeof (struct case_node) )
;
+ cn = xmalloc
( sizeof *cn)
;
cn->next = (*wv)->case_nos ;
cn->num = case_no;
cn->next = (*wv)->case_nos ;
cn->num = case_no;
@@
-107,7
+107,7
@@
metrics_calc(struct metrics *fs, const union value *val,
(*wv)->v = *val;
(*wv)->w = weight;
(*wv)->v = *val;
(*wv)->w = weight;
- cn = xmalloc
( sizeof (struct case_node) )
;
+ cn = xmalloc
(sizeof *cn)
;
cn->next=0;
cn->num = case_no;
(*wv)->case_nos = cn;
cn->next=0;
cn->num = case_no;
(*wv)->case_nos = cn;
@@
-215,7
+215,7
@@
struct weighted_value *
weighted_value_create(void)
{
struct weighted_value *wv;
weighted_value_create(void)
{
struct weighted_value *wv;
- wv = xmalloc (sizeof
(struct weighted_value )
);
+ wv = xmalloc (sizeof
*wv
);
wv->cc = 0;
wv->case_nos = 0;
wv->cc = 0;
wv->case_nos = 0;
@@
-256,11
+256,11
@@
create_factor_statistics (int n, union value *id0, union value *id1)
{
struct factor_statistics *f;
{
struct factor_statistics *f;
- f =
xmalloc( sizeof ( struct factor_statistics )
);
+ f =
xmalloc (sizeof *f
);
f->id[0] = *id0;
f->id[1] = *id1;
f->id[0] = *id0;
f->id[1] = *id1;
- f->m = x
malloc( sizeof ( struct metrics ) * n )
;
+ f->m = x
nmalloc (n, sizeof *f->m)
;
memset (f->m, 0, sizeof(struct metrics) * n);
f->n_var = n;
memset (f->m, 0, sizeof(struct metrics) * n);
f->n_var = n;