Clear undefined behavior in libgcry.c
Also see GitHub issue https://github.com/rsyslog/rsyslog/issues/5167 and PR https://github.com/rsyslog/rsyslog/issues/5168.
Also see GitHub issue https://github.com/rsyslog/rsyslog/issues/5167 and PR https://github.com/rsyslog/rsyslog/issues/5168.