]> granicus.if.org Git - p11-kit/commitdiff
uri: Avoid typecasting confusion on s390x
authorDaiki Ueno <dueno@redhat.com>
Mon, 16 Jan 2017 13:06:30 +0000 (14:06 +0100)
committerDaiki Ueno <ueno@gnu.org>
Tue, 17 Jan 2017 09:20:27 +0000 (10:20 +0100)
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

index 75d2e846ad1c9fb9449bfee3b68b52a9f3e66801..2659fab836152037c8274664fab067259244e3d0 100644 (file)
@@ -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);