summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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());