]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/mbsalign: Fix escaping nonprintable multibyte characters
authorVaclav Dolezal <vdolezal@redhat.com>
Thu, 11 Jan 2018 09:42:22 +0000 (10:42 +0100)
committerVaclav Dolezal <vdolezal@redhat.com>
Thu, 11 Jan 2018 09:42:22 +0000 (10:42 +0100)
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
lib/mbsalign.c

index 3959d46ddf5eaa9ba778e900ee43558bcb222738..8fdab9ee90f6c1dba8ae019f1d277233af20a578 100644 (file)
@@ -168,7 +168,7 @@ char *mbs_safe_encode_to_buffer(const char *s, size_t *width, char *buf, const c
                        } else if (!iswprint(wc)) {
                                size_t i;
                                for (i = 0; i < len; i++) {
-                                       sprintf(r, "\\x%02x", (unsigned char) *p);
+                                       sprintf(r, "\\x%02x", (unsigned char) p[i]);
                                        r += 4;
                                        *width += 4;
                                }