Strange result using base64_decode
Posted: Thu Jul 25, 2024 5:15 pm
Hello,
I came across a strange behaviour of the base64_decode function. This is the code that I have:
If I uncomment the "message = '';" line the decode doesn't return the correct value. The length of the variable is set correctly but the string is not decoded.
When the line is commented as it is it works fine.
It seems that base64_decode takes into account the length of the variable before the call when it should not. Or is this rather a compiler issue (we are not quite current on PTFs)?
Regards,
Peter
I came across a strange behaviour of the base64_decode function. This is the code that I have:
Code: Select all
H DFTACTGRP(*NO) actgrp(*caller) decedit('.')
H debug option(*srcstmt:*nodebugio:*noshowcpy)
H bnddir('BASE64')
/copy BASE64_H
d message s 80000a ccsid(*utf8) varying inz(*all' ')
d msg s 80000a varying
// message = '';
msg = 'SGkgVGhlcmUu';
%len(message)=base64_decode(
%addr(msg:*data):%len(msg):
%addr(message:*data):%len(message:*max));
*inlr = *on;
When the line is commented as it is it works fine.
It seems that base64_decode takes into account the length of the variable before the call when it should not. Or is this rather a compiler issue (we are not quite current on PTFs)?
Regards,
Peter