diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2019-05-14 20:39:36 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2019-05-14 20:39:36 +0200 |
commit | 753c08a0227307e7dec34661c757f4642ffc22f7 (patch) | |
tree | 58df4963f2bdf90fea5903d01176e719331118b2 /src | |
parent | b05869385871ba7048af2aebb421a3519fcae312 (diff) | |
download | pacman-auto-pentium4.tar.xz |
increased machine size in pacman.c by oneauto-pentium4
fixed around letting machine not NUL-terminated when architecture is 'petntium4'
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/pacman.c | 11 |
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()); |