package

simple and robust package manager
Log | Files | Refs | README

commit ec04b033d02f3ee762415ad1114bffc6f694c6ce
parent 8f90967e6dc0b30feb66818b8b6b05d1f3cf1d32
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 18 Jan 2019 01:21:26 +0100

fix signed char overflow

avoid interpretation of sign by casting to unsiged as we process char * as a
stream of bytes

Diffstat:
M.gitignore | 10+++++-----
Mfmt.c | 10+++++-----
Dpackage-add | 0
Dpackage-build | 0
Dpackage-dep | 0
Dpackage-get | 0
Dpackage-tree | 0
7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,7 +1,7 @@ *.o *.core -pack-build -pack-add -pack-dep -pack-get -pack-tree +package-build +package-add +package-dep +package-get +package-tree diff --git a/fmt.c b/fmt.c @@ -165,15 +165,15 @@ fmt_xlong0(char *buf, unsigned long i, size_t pad) } size_t -fmt_xbuf(char const *pack, size_t n, char *s) +fmt_xbuf(char const *buf, size_t n, char *dest) { - char *ascii = "0123456789abcdefghijklmnopqrstuvwxyz"; + char *ascii = "0123456789abcdef"; - if (!s) return n * 2; + if (!dest) return n * 2; for (size_t i = 0; i < n; ++i) { - s[i * 2] = ascii[pack[i] >> 4]; - s[i * 2 + 1] = ascii[pack[i] & 0x0f]; + dest[i * 2] = ascii[(unsigned char)buf[i] >> 4]; + dest[i * 2 + 1] = ascii[(unsigned char)buf[i] & 0x0f]; } return n * 2; diff --git a/package-add b/package-add Binary files differ. diff --git a/package-build b/package-build Binary files differ. diff --git a/package-dep b/package-dep Binary files differ. diff --git a/package-get b/package-get Binary files differ. diff --git a/package-tree b/package-tree Binary files differ.