diff options
author | Aaron Griffin <aaron@archlinux.org> | 2007-03-06 04:22:03 +0000 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-03-06 04:22:03 +0000 |
commit | 90b75a04351242c5b242359008a51c2fb0dd1d41 (patch) | |
tree | b7ac04003c9d7f45fd6668137e11b26d16a16b74 /lib/libalpm/sha1.c | |
parent | 5baba8439761a54c488ff42e4e599b3c93dbe669 (diff) | |
download | pacman-90b75a04351242c5b242359008a51c2fb0dd1d41.tar.xz |
* Fix the double package name URL when using XferCommand
* Fixed valgrind yelling about the sprintfs in md5/sha1 routines
Diffstat (limited to 'lib/libalpm/sha1.c')
-rw-r--r-- | lib/libalpm/sha1.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libalpm/sha1.c b/lib/libalpm/sha1.c index d9a9118d..fd5f1e4a 100644 --- a/lib/libalpm/sha1.c +++ b/lib/libalpm/sha1.c @@ -387,6 +387,7 @@ char* _alpm_SHAFile(char *filename) { FILE *file; struct sha_ctx context; int len, i; + char hex[3]; unsigned char buffer[1024], digest[20]; char *ret; @@ -405,7 +406,8 @@ char* _alpm_SHAFile(char *filename) { ret = (char*)malloc(41); ret[0] = '\0'; for(i = 0; i < 20; i++) { - sprintf(ret+(i*2), "%02x", digest[i]); + snprintf(hex, 3, "%02x", digest[i]); + strncat(ret, hex, 2); } _alpm_log(PM_LOG_DEBUG, _("sha1(%s) = %s"), filename, ret); return(ret); |