From a126365a49547da6b532210a886bb5d5fc531b77 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 16 Jan 2017 14:06:30 +0100 Subject: uri: Avoid typecasting confusion on s390x Like memcpy(), the 'void *' argument of p11_buffer_add() points to the memory area ordered in host's endianness. Add typecast of int->char to avoid the confusion. Reported by Andreas Metzler in: https://lists.freedesktop.org/archives/p11-glue/2017-January/000633.html --- p11-kit/uri.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/p11-kit/uri.c b/p11-kit/uri.c index 75d2e84..2659fab 100644 --- a/p11-kit/uri.c +++ b/p11-kit/uri.c @@ -765,8 +765,10 @@ format_name_equals (p11_buffer *buffer, enum uri_sep *sep, const char *name) { - if (*sep) - p11_buffer_add (buffer, sep, 1); + if (*sep) { + char c = *sep; + p11_buffer_add (buffer, &c, 1); + } p11_buffer_add (buffer, name, -1); p11_buffer_add (buffer, "=", 1); -- cgit v1.1