Skip to content

Commit

Permalink
bound lso/lsi to limit of dbAddr::field_size
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed May 19, 2024
1 parent d8b5616 commit e5b4829
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions modules/database/src/std/rec/lsiRecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ static long init_record(struct dbCommon *pcommon, int pass)
if (sizv < 16) {
sizv = 16; /* Enforce a minimum size for the VAL field */
prec->sizv = sizv;
} else if (sizv > 0x7fff) {
sizv = 0x7fff; /* SIZV is unsigned, but dbAddr::field_size is signed */
prec->sizv = sizv;
}

prec->val = callocMustSucceed(1, sizv, "lsi::init_record");
Expand Down
3 changes: 3 additions & 0 deletions modules/database/src/std/rec/lsoRecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ static long init_record(struct dbCommon *pcommon, int pass)
if (sizv < 16) {
sizv = 16; /* Enforce a minimum size for the VAL field */
prec->sizv = sizv;
} else if (sizv > 0x7fff) {
sizv = 0x7fff; /* SIZV is unsigned, but dbAddr::field_size is signed */
prec->sizv = sizv;
}

prec->val = callocMustSucceed(1, sizv, "lso::init_record");
Expand Down
2 changes: 1 addition & 1 deletion modules/database/src/std/rec/lsoRecord.dbd.pod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ C<supervisory> is specified, DOL is ignored, the current value of VAL is
written, and VAL can be changed externally via dbPuts at run-time.

The maximum number of characters in VAL is given by SIZV, and cannot be larger
than 65535.
than 32767.

DOL can also be a constant instead of a link, in which case VAL is initialized
to the constant value. Most simple string constants are likely to be interpreted
Expand Down

0 comments on commit e5b4829

Please sign in to comment.