summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/util.h
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-29 19:18:59 +0200
committerAurelien Foret <aurelien@archlinux.org>2005-03-29 19:18:59 +0200
commit6063424c82f18f3ea8bbf9a92fd30b349ec778bd (patch)
tree398d20c2637ddf5a44ddcfbeacb449c256e71c18 /lib/libalpm/util.h
parent3ac94cc71905535252db84f8a0c26a4f59d8162c (diff)
downloadpacman-6063424c82f18f3ea8bbf9a92fd30b349ec778bd.tar.gz
pacman-6063424c82f18f3ea8bbf9a92fd30b349ec778bd.tar.xz
Replaced snprintf calls by the SNPRINTF macro to avoid buffer overflows when copying strings
Diffstat (limited to 'lib/libalpm/util.h')
-rw-r--r--lib/libalpm/util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 3776ebbc..7393c8d5 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -38,6 +38,11 @@
#define ASSERT(cond, action) do { if(!(cond)) { action; } } while(0)
+#define STRNCPY(s1, s2, len) do { \
+ strncpy(s1, s2, (len)-1); \
+ s1[(len)-1] = 0; \
+} while(0)
+
long _alpm_gzopen_frontend(char *pathname, int oflags, int mode);
int _alpm_makepath(char *path);
int _alpm_copyfile(char *src, char *dest);