os400: Fix IBMi EBCDIC conversion of arguments

- Fix the length of strings passed to iconv_open.

IBM's iconv_open expects parameters to be a pointer to a 32 byte
character array with the unused fields set to 0.

Prior to this change, since 8c62479a (precedes 8.11.0), it was
incorrectly passed pointers to smaller length const strings and curl
would fail with error "blank argument where content is expected".

Reported-by: Andrew Kirillov

Ref: https://www.ibm.com/docs/en/i/7.5?topic=ssw_ibm_i_75/apis/iconvopn.html

Fixes https://github.com/curl/curl/issues/15570
Closes https://github.com/curl/curl/pull/15574
This commit is contained in:
andrewkirillov-ibm 2024-11-13 14:40:44 +00:00 committed by Jay Satiro
parent 1a3408d6d8
commit 0b3b61cc76

View File

@ -61,8 +61,10 @@ int main(int argc, char **argv)
size_t inbytesleft;
size_t outbytesleft;
char dummybuf[128];
const char *tocode = "IBMCCSID01208"; /* Use UTF-8. */
const char *fromcode = "IBMCCSID000000000010";
/* To/From codes are 32 byte long strings with
reserved fields initialized to ZEROs */
const char tocode[32] = {"IBMCCSID01208"}; /* Use UTF-8. */
const char fromcode[32] = {"IBMCCSID000000000010"};
ebcdic_argc = argc;
ebcdic_argv = argv;