Commit 5e5169d2 authored by John P. Willis's avatar John P. Willis
Browse files

Check for NULL subscripts in local variables and return ZSBSCR if any are found

parent e76458c2
Pipeline #747 passed with stage
in 1 minute and 27 seconds
......@@ -171,6 +171,7 @@ freem_ref_t *internal_to_mref (freem_ref_t *ref, char *key)
tmp[j] = '\0';
mref_set_subscript (ref, i++, tmp);
ref->subscript_count++;
j = 0;
tmp[j] = '\0';
......@@ -189,7 +190,7 @@ freem_ref_t *internal_to_mref (freem_ref_t *ref, char *key)
/* grab the last one */
mref_set_subscript (ref, i, tmp);
free (nam);
free (tmp);
......
......@@ -38,8 +38,30 @@
**/
#include "mpsdef.h"
#include "mref.h"
void symtab (short action, char *key, char *data)
{
register int i;
freem_ref_t *r = (freem_ref_t *) malloc (sizeof (freem_ref_t));
NULLPTRCHK(r,"symtab");
mref_init (r, MREF_RT_LOCAL, "");
internal_to_mref (r, key);
for (i = 0; i < r->subscript_count; i++) {
if (strlen (r->subscripts[i]) < 1) {
ierr = SBSCR;
free (r);
return;
}
}
symtab_bltin (action, key, data);
free (r);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment