Operating System - OpenVMS
1820247 Members
2794 Online
109621 Solutions
New Discussion юеВ

DCL Command Buffer Overflow with 'a[n,n] := b'

 
SOLVED
Go to solution
Robert Atkinson
Respected Contributor

DCL Command Buffer Overflow with 'a[n,n] := b'

I have a routine that builds up a record using field registers, like this :-

$ DCF$'AREANAME'_RECORD['TEMP'] :== "''FIELD'"

Problem is, one of the field lengths is 400 characters, which blows the DCL limitation.

So, I tried doing :-

$ DCF$'AREANAME'_RECORD['TEMP'] == FIELD

....so that the translation is internal, but this gives :-

$ DCF$WEBR_RECORD[10,400] == FIELD
%DCL-W-IVCHAR, invalid numeric value - check for invalid digits
\ FIELD\

Can anyone think of a clever way to translate the field and store it in a record section, without having to use a literal?

Rob.
19 REPLIES 19
Robert Atkinson
Respected Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'


Beginning to think it's an oversight by the engineers, from when they extended the DCL limits.

If the command string is greater than 254 characters, it fails :-

GAMNEW_ROB$ A = F$FAO("!229*X")
GAMNEW_ROB$ DCF$EMD_RECORD[51,400] :== "''A'"
GAMNEW_ROB$ A = F$FAO("!230*X")
GAMNEW_ROB$ DCF$EMD_RECORD[51,400] :== "''A'"
%DCL-W-BUFOVF, command buffer overflow - shorten expression or command line
\DCF$EMD_RECORD[51,400]:==XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I am correct in thinking the DCL command line limit went to 1000 characters, or something similar on VMS 7.3-2?

Rob.
Karl Rohwedder
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Rob,
perhaps you can store the elements in separate symbols and add them at the end, e.g.

- this doesn't work

$ b=f$fao("!500*X")
$ a[10,500]:="''b'"
%DCL-W-BUFOVF, command buffer overflow - shorten expression or command line
\A[10,500]:=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX

- but
$ a=F$Fao("!10* ")
$ a=a+b
$ sh sym a
A = " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

regards Kalle
Robert Atkinson
Respected Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Because the utility is designed to work with individual fields within the record, that just wouldn't be feasable.

I'd have to reconstruct the whole record from scratch every time I updated a single field.

Rob.
Jan van den Ende
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Robert,

for completeness: Which version / DCL patch level of VMS?

EDCL only came into VMS 7.3-2 by a DCL patch.
So before, this is entyrely to be expected, but after, I would call it a bug, of which Guy Peleg should be made aware.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Hein van den Heuvel
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'


- Embrace DATATRIEVE

- Document a 255 byte field length limitation for your tool, after estimating how much impact that woudl have. Offer workaround using multiple adjacent fields.

- Learn Pearl

- use a look-aside exception construction..
IF (F$TYPE(EXTENDED_'FIELDNAME')
THEN
$ DCF$'AREANAME'_RECORD['TEMP_PART_2'] :== F$EXTR(256,999,FIELD)
:

Hein.

Robert Atkinson
Respected Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'


DEC AXPVMS VMS732_UPDATE V4.0 Patch Install 07-MAY-2005 09:11:18

Which contains DCL v2 I believe. I'll check out the latest versions of DCL to see if this has been corrected.

Any idea how I can email Guy?

Rob.
Robert Atkinson
Respected Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Last option won't work I'm afraid Hein :-

ALPHA_ROB$$$ a[10,20] := f$ext(0,99,b)
ALPHA_ROB$$$ sh sym a
A = " F$EXT(0,99,B) "

Rob.
Hein van den Heuvel
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Right.. sorry 'bout that. Just Cutting&Pasting.
It was just some handwaving to indicate a general direction, not to be used as exact example.
The implications of the := string assignment are intriuging (sp?) right?
Using = turns the [x,y] into a bitfield descriptor.

So it is back to the explicit substitution, with double-quote plus double single quote...

a[10,20] := f$ext(0,99,b)$ a[10,20] := "''f$ext(0,99,b)
$ show symb a
A = " TEST "

The other that is always fun about the = vs := assignments is how to get DCL help for it.
The intuitive $HELP = does not work of course as that looks too much like you are assigning something to the symbol help.
You have to go into interactive help, and then type in = (or := ) at the " Press RETURN to continue ... " prompt (or the "Topic? " prompt)

Hein.
Jan van den Ende
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Yeah...

Hein already hinted at the solution:

VMS V7.3-2:

$ aaa = "abc"
$ xyz'aaa'[30,400]:="very long text"
$ sho sym xyzabc
XYZABC = "<30 spaces>very long text<386 spaces>"

Problem solved?

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Robert Atkinson
Respected Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Nope - as soon as the literal gets above 230'ish characters, it blows (as per my example). The total command cannot exceed 255 characters.

Rob.
John Abbott_2
Esteemed Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

> Any idea how I can email Guy?

I've always got a reply from Guy using
dcl@hp.com

Kind Regards
John.
Don't do what Donny Dont does
Jan van den Ende
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Robert,

SOMETHING is weird here!

My example is a litteral transcript from what I executed seconds before on our system.

$ field = "tekst"
$ temp = "10,400"
$ aaa = "xyz"
$ abc'aaa'def['temp']:="''field'"

$ show symb abc*

ABCXYZDEF = "<10 spaces>tekst<385 spaces>

For a better visibility, copy/paste the DCL above into any plain ASCII editor.

Points of attention:
- NO spaces between symbolname and [
- STRING assignment symbol MUST be := or :==;
= or == together with [ ] means integer assignment, with BIT specification between the [ ]
- right-hand-side of assignment MUST be between double "" , or it get compressed
- normal value substitution inside string, double ' to open, and single ' to close symbol substitution.

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Hein van den Heuvel
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Well, for sure I learned a little 'handy' thing in this string.

Like Kalle I used to use constructs like: $ b=f$fao("!500*X") to generate a long string.

Now I may just switch to b[0,500]=" " when all I need is space.
And I may just start to use:
$del/sym b
$b[40,20] = text

To create 'aligned strings', starting with leading spaces and having a selected length.



Warning... as you are playing with this an other limitation you are likely to run into is documented under "help := parameter".
[offset,size] ... The value of the size plus the offset must not
exceed 769.

So if you only use this [] method to assign fields into a record, then you are stuck to 769 byte max record length, not 1024.



Hein.




Hein van den Heuvel
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Boy, I should be careful writing real code/reports today.
I'm sloppy.
I meant to use := assignments throughout the last reply.
Sorry for the clutter!
Better start brewing a pot of coffee, and use some, before I touch the keyboards again.

:-)

Hein.
Jan van den Ende
Honored Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Hein,


Warning... as you are playing with this an other limitation you are likely to run into is documented under "help := parameter".
[offset,size] ... The value of the size plus the offset must not
exceed 769.


I guess the HELP should be updated:

Changing TEMP in the example above to be "500,1400" results in a string with a length of 1900.
"2500,1400" => length 3900
Even "2500,2400" gives length 4900, but on showing the symbol I get %DCL-I-SYMTRUNC
But WRITE/SYMBOL SYS$OUTPUT still gives the full string.

Further testing: string length 7937 is still valid, 7938 gives DCL-W-INVRANGE

Proost.

Have one on me.

jpe

Don't rust yours pelled jacker to fine doll missed aches.
Robert Atkinson
Respected Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Jan, you example will work because the total length of the 4th command ($ abc'aaa'def['temp']:="''field'"
) does not go over the 255 character limit.

If you were to equate 'field' to a 300 character string, it would fail.

Rob.
Guy Peleg
Respected Contributor
Solution

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

First few clarifications:

1. Extended DCL (aka EDCL) support shipped
with v7.3-2, no patch kits are required.

2. With EDCL, the length of the command line
increased from 255 characters to 4096. Using
hyphens the command may be expended up
to 8192 characters. Symbols are limited to
8192 characters.

3. OpenVMS V8.2 added support for large
tokens. Large tokens allows each token
on the command line to be 4000 characters
(tokens are limited to 255 characters
with V7.3-2).

Now to your question....you found a bug !

The command line limitations used
by DCL are constant in an SDL file. I found
one location where the limit is hardcoded
to 255. I changed it to use the symbolic
value and all is well....

Please file an official problem report
through your local support channel to
obtain the new image.

Thank you for finding this !
It is not everyday that someone finds
a bug in DCL (I'm talking about the CLI
not the related utilities). Come to
the bootcamp and I'll buy you a beer ;-)

Guy Peleg
OpenVMS Engineering
Peter Weaver_1
Frequent Advisor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Until Guy gets DCL fixed can you just do;

$ TEMP="10,200"
$ DCF$'AREANAME'_RECORD['TEMP']:== "''F$EXTRACT(0,200,FIELD)'"
$ TEMP="200,200"
$ DCF$'AREANAME'_RECORD['TEMP']:== "''F$EXTRACT(200,200,FIELD)'"

?
Robert Atkinson
Respected Contributor

Re: DCL Command Buffer Overflow with 'a[n,n] := b'

Guy has confirmed that this is a bug, and will be releasing a fix in DCL v8.

In addition, there's also a similar bug with long symbol lengths in F$TYPE() which is being corrected (not sure if it's a good or bad month for me!).

Thanks for everyone's help on this.

Rob.