From: andrewkirillov-ibm Date: Wed, 13 Nov 2024 14:40:44 +0000 (+0000) Subject: os400: Fix IBMi EBCDIC conversion of arguments X-Git-Tag: curl-8_11_1~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b3b61cc76d705068f7c3feced72943bbe5abc20;p=thirdparty%2Fcurl.git 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 --- diff --git a/packages/OS400/curlmain.c b/packages/OS400/curlmain.c index a36de32204..079b9b0d9d 100644 --- a/packages/OS400/curlmain.c +++ b/packages/OS400/curlmain.c @@ -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;