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
/
sysfile-info.c
diff --git
a/src/sysfile-info.c
b/src/sysfile-info.c
index 45bffad762d22c03ce38434b757772ad5040931c..b5f559e5185527a9f68f8397d535db93cf56cb56 100644
(file)
--- a/
src/sysfile-info.c
+++ b/
src/sysfile-info.c
@@
-29,6
+29,7
@@
#include "file-handle.h"
#include "hash.h"
#include "lexer.h"
#include "file-handle.h"
#include "hash.h"
#include "lexer.h"
+#include "magic.h"
#include "misc.h"
#include "output.h"
#include "sfm-read.h"
#include "misc.h"
#include "output.h"
#include "sfm-read.h"
@@
-171,7
+172,7
@@
cmd_sysfile_info (void)
static void display_macros (void);
static void display_documents (void);
static void display_macros (void);
static void display_documents (void);
-static void display_variables (struct variable **,
in
t, int);
+static void display_variables (struct variable **,
size_
t, int);
static void display_vectors (int sorted);
int
static void display_vectors (int sorted);
int
@@
-181,7
+182,7
@@
cmd_display (void)
int sorted;
/* Variables to display. */
int sorted;
/* Variables to display. */
-
in
t n;
+
size_
t n;
struct variable **vl;
if (lex_match_id ("MACROS"))
struct variable **vl;
if (lex_match_id ("MACROS"))
@@
-247,7
+248,7
@@
cmd_display (void)
if (as == AS_SCRATCH)
{
if (as == AS_SCRATCH)
{
-
in
t i, m;
+
size_
t i, m;
for (i = 0, m = n; i < n; i++)
if (dict_class_from_id (vl[i]->name) != DC_SCRATCH)
{
for (i = 0, m = n; i < n; i++)
if (dict_class_from_id (vl[i]->name) != DC_SCRATCH)
{
@@
-341,7
+342,7
@@
variables_dim (struct tab_table *t, struct outp_driver *d)
}
static void
}
static void
-display_variables (struct variable **vl,
in
t n, int as)
+display_variables (struct variable **vl,
size_
t n, int as)
{
struct variable **vp = vl; /* Variable pointer. */
struct tab_table *t;
{
struct variable **vp = vl; /* Variable pointer. */
struct tab_table *t;
@@
-349,7
+350,7
@@
display_variables (struct variable **vl, int n, int as)
int nr; /* Number of rows. */
int pc; /* `Position column' */
int r; /* Current row. */
int nr; /* Number of rows. */
int pc; /* `Position column' */
int r; /* Current row. */
-
in
t i;
+
size_
t i;
_as = as;
switch (as)
_as = as;
switch (as)
@@
-575,7
+576,7
@@
display_vectors (int sorted)
return;
}
return;
}
- vl = x
malloc (sizeof *vl * nvec
);
+ vl = x
nmalloc (nvec, sizeof *vl
);
for (i = 0; i < nvec; i++)
vl[i] = dict_get_vector (default_dict, i);
if (sorted)
for (i = 0; i < nvec; i++)
vl[i] = dict_get_vector (default_dict, i);
if (sorted)