Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whitelist adjustments #296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

whitelist adjustments #296

wants to merge 1 commit into from

Conversation

GitMensch
Copy link

fixing a reference-out-of-bounds exception in case of "list" command and lots of whitelisted users (max: 100 users * 16 chars = 1600 with buffer being of size 255)

showcasing:

  • STRING ... WITH POINTER (that would also never write out of bounds and would allow an easy ON OVERFLOW EXIT PERFORM)
  • EVALUATE statement, including ALSO
  • mixed static and "if needed" dynamic memory

Warning: the initial reason was showcasing this use of EVALUATE, followed by recognition of better using STRING WITH POINTER, then realizing a not unlikely exception (first fixed by that ON OVERFLOW), then thinking about showcasing dynamic memory...

This PR is: totally untested (just checked that it compiles with GC 3.1, which needed some adjustments how ALLOCATE+FREE are used) and GC 3.2 and additional needs #294 to be merged up-front (if not wanted a MOVE SPACES TO DYN-BUFFER (BUFFER-POS:) instead of that SUBTRACT to get the length would be possible).

As noted this was mostly about showcasing those more rare used COBOL language features, feel free to pick only parts and/or adjust if others fall in the "less clear" or even "unmaintainable" state. The thing that likely should get in is the STRING (with ON OVERFLOW if the dynamic memory part is not used.

fixing a reference-out-of-bounds exception in case of "list" command and lots of whitelisted users (max: 100 users * 16 chars = 1600 with buffer being of size 255)

showcasing:
* STRING ... WITH POINTER (that would also never write out of bounds and would allow an easy ON OVERFLOW EXIT PERFORM)
* EVALUATE statement, including ALSO
* mixed static and "if needed" dynamic memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant