diff options
author | Darik Horn <[email protected]> | 2013-01-14 19:27:39 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-01-16 10:15:57 -0800 |
commit | 38145d612963d0a5b80017d5d1d49c1d4f9637c2 (patch) | |
tree | fa653572e918b47115a0a28ccd597c83ea3e0bf9 /lib | |
parent | b077fd4c4e16d372ef81035199e132687dbcf0e3 (diff) |
Ensure that zfs diff prints unicode safely.
In the stream_bytes() library function used by `zfs diff`, explicitly
cast each byte in the input string to an unsigned character so that the
Linux fprintf() correctly escapes to octal and does not mangle the output.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1172
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs_diff.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_diff.c b/lib/libzfs/libzfs_diff.c index 8140a703a..eb05f4d5b 100644 --- a/lib/libzfs/libzfs_diff.c +++ b/lib/libzfs/libzfs_diff.c @@ -141,7 +141,7 @@ stream_bytes(FILE *fp, const char *string) if (*string > ' ' && *string != '\\' && *string < '\177') (void) fprintf(fp, "%c", *string++); else - (void) fprintf(fp, "\\%03o", *string++); + (void) fprintf(fp, "\\%03o", (unsigned char)*string++); } } |