diff options
author | Klaus Alexander Seistrup <kseistrup@users.noreply.github.com> | 2014-02-09 08:42:40 +0100 |
---|---|---|
committer | Klaus Alexander Seistrup <kseistrup@users.noreply.github.com> | 2014-02-09 08:42:40 +0100 |
commit | 735e6a601dbb851cdc110480202232c0dede2291 (patch) | |
tree | c1e3238e10d7d91cfcbef3eeb4f743aecadefac7 /c/sha3sum.c | |
parent | misc (diff) | |
download | sha3sum-735e6a601dbb851cdc110480202232c0dede2291.tar.gz sha3sum-735e6a601dbb851cdc110480202232c0dede2291.tar.bz2 sha3sum-735e6a601dbb851cdc110480202232c0dede2291.tar.xz |
Update sha3sum.c
The code in sha3sum.c didn't put a `'\0'` char at the end of the `out` buffer, and the binary equivalent of the hexdigest was output to the terminal.
This patch seems to remedy the case and fixes #10.
Diffstat (limited to 'c/sha3sum.c')
-rw-r--r-- | c/sha3sum.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/c/sha3sum.c b/c/sha3sum.c index 87480ea..c955d52 100644 --- a/c/sha3sum.c +++ b/c/sha3sum.c @@ -646,6 +646,7 @@ int main(int argc, char** argv) *(out + outptr++) = HEXADECA[(v >> 4) & 15]; *(out + outptr++) = HEXADECA[v & 15]; } + out[outptr] = '\0'; printf("%s %s\n", out, filename ? filename : "-"); } } @@ -662,6 +663,7 @@ int main(int argc, char** argv) out[b * 2 ] = HEXADECA[(v >> 4) & 15]; out[b * 2 + 1] = HEXADECA[v & 15]; } + out[b*2] = '\0'; printf("%s %s\n", out, filename ? filename : "-"); } for (_ = 1; _ < i; _++) @@ -685,6 +687,7 @@ int main(int argc, char** argv) out[b * 2 ] = HEXADECA[(v >> 4) & 15]; out[b * 2 + 1] = HEXADECA[v & 15]; } + out[b*2] = '\0'; printf("%s\n", out); } } |