Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-05-14 20:39:36 +0200
committerErich Eckner <git@eckner.net>2020-01-29 11:00:31 +0100
commite445f149836c82745e057a8fcfb1f062b2abb98f (patch)
treefe00f8d7809793158b6e558b03fd926220f81052
parentd9d3c1e8515e5fd8713f3da62a6857c35e31ea83 (diff)
increased machine size in pacman.c by one
fixed around letting machine not NUL-terminated when architecture is 'petntium4'
-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 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());