[sr-dev] git:5.5:c4e70496: kex: add additional safety checks for printing, based on PR #3250 from bensly-shanmugam