index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2019-05-14 20:39:36 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-01-29 11:00:31 +0100 |
commit | e445f149836c82745e057a8fcfb1f062b2abb98f (patch) | |
tree | fe00f8d7809793158b6e558b03fd926220f81052 /src | |
parent | d9d3c1e8515e5fd8713f3da62a6857c35e31ea83 (diff) |
-rw-r--r-- | src/pacman/pacman.c | 11 |
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 368bd56b..b11a2f14 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -272,12 +272,15 @@ static void setuseragent(void) int len; uname(&un); - char machine[8]; - strncpy(machine, un.machine, 8); + char machine[9]; + strncpy(machine, un.machine, sizeof machine); + machine[sizeof machine-1] = '\0'; if(strcmp(machine, "i686") == 0) { __builtin_cpu_init(); - if (__builtin_cpu_supports("sse2")) - strncpy(machine, "pentium4", 8); + if (__builtin_cpu_supports("sse2")) { + strncpy(machine, "pentium4", sizeof machine); + machine[sizeof machine-1] = '\0'; + } } len = snprintf(agent, 100, "pacman/%s (%s %s) libalpm/%s", PACKAGE_VERSION, un.sysname, machine, alpm_version()); |