summaryrefslogtreecommitdiff
path: root/lib/libalpm/cache.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-29 17:18:59 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-29 17:18:59 +0000
commit6063424c82f18f3ea8bbf9a92fd30b349ec778bd (patch)
tree398d20c2637ddf5a44ddcfbeacb449c256e71c18 /lib/libalpm/cache.c
parent3ac94cc71905535252db84f8a0c26a4f59d8162c (diff)
downloadpacman-6063424c82f18f3ea8bbf9a92fd30b349ec778bd.tar.xz
Replaced snprintf calls by the SNPRINTF macro to avoid buffer overflows when copying strings
Diffstat (limited to 'lib/libalpm/cache.c')
-rw-r--r--lib/libalpm/cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 09d508a8..34f3d07c 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -28,6 +28,7 @@
#include <sys/stat.h>
/* pacman */
#include "list.h"
+#include "util.h"
#include "package.h"
#include "group.h"
#include "db.h"
@@ -125,7 +126,7 @@ int db_load_grpcache(pmdb_t *db)
if(!pm_list_is_strin(i->data, db->grpcache)) {
pmgrp_t *grp = grp_new();
- strncpy(grp->name, (char *)i->data, 256);
+ STRNCPY(grp->name, (char *)i->data, GRP_NAME_LEN);
grp->packages = pm_list_add_sorted(grp->packages, pkg->name, grp_cmp);
db->grpcache = pm_list_add_sorted(db->grpcache, grp, grp_cmp);
} else {