summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-05-14 20:39:36 +0200
committerErich Eckner <git@eckner.net>2019-05-15 11:04:50 +0200
commit3dc95902344b71c9b9eb89ab0a9d6e7706959013 (patch)
tree20d82dddd1e5cf1d462f852d4e4e2b8d037fa3e3 /src
parentcb317944e36b6fa1b68abe80fa1e54270f3a0840 (diff)
downloadpacman-master.tar.xz
increased machine size in pacman.c by oneHEADmaster
fixed around letting machine not NUL-terminated when architecture is 'petntium4'
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index abb6f933..34aace6c 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -274,12 +274,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());