diff options
author | tnn <tnn@pkgsrc.org> | 2016-08-24 07:16:22 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2016-08-24 07:16:22 +0000 |
commit | 6ee96f938b038a55fd869329c6ae22f8d1835046 (patch) | |
tree | aa18d37835aad4fed85ea12fd80fd8de1345a6af /x11 | |
parent | c7e9e04a06e9d5876f7ee331338053f596c20bd9 (diff) | |
download | pkgsrc-6ee96f938b038a55fd869329c6ae22f8d1835046.tar.gz |
Change an sprintf to snprintf in attempt to appease stack protector.
No functional change; the buffer is large enough.
Diffstat (limited to 'x11')
-rw-r--r-- | x11/libxshmfence/Makefile | 4 | ||||
-rw-r--r-- | x11/libxshmfence/files/xshmfence_semaphore.c | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/x11/libxshmfence/Makefile b/x11/libxshmfence/Makefile index d1072deb0f3..047cbba1d10 100644 --- a/x11/libxshmfence/Makefile +++ b/x11/libxshmfence/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.6 2016/05/04 02:54:46 tnn Exp $ +# $NetBSD: Makefile,v 1.7 2016/08/24 07:16:22 tnn Exp $ DISTNAME= libxshmfence-1.2 -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= x11 MASTER_SITES= http://xorg.freedesktop.org/archive/individual/lib/ EXTRACT_SUFX= .tar.bz2 diff --git a/x11/libxshmfence/files/xshmfence_semaphore.c b/x11/libxshmfence/files/xshmfence_semaphore.c index ef1a82f8a5d..c1728177ee5 100644 --- a/x11/libxshmfence/files/xshmfence_semaphore.c +++ b/x11/libxshmfence/files/xshmfence_semaphore.c @@ -33,7 +33,7 @@ #include "xshmfenceint.h" -static sem_t *mksemtemp(char *, const char *); +static sem_t *mksemtemp(char *, size_t, const char *); #define LOCK() do {} while (sem_wait(f->lock) != 0) #define UNLOCK() do { sem_post(f->lock); } while (0) @@ -159,12 +159,12 @@ xshmfence_init(int fd) __sync_fetch_and_and(&f.triggered, 0); __sync_fetch_and_and(&f.waiting, 0); - lock = mksemtemp(f.lockname, "/xshmfl-%i"); + lock = mksemtemp(f.lockname, sizeof(f.lockname) - 1, "/xshmfl-%i"); if (lock == SEM_FAILED) { err(EXIT_FAILURE, "xshmfence_init: sem_open"); } - cond = mksemtemp(f.condname, "/xshmfc-%i"); + cond = mksemtemp(f.condname, sizeof(f.condname) - 1, "/xshmfc-%i"); if (cond == SEM_FAILED) { err(EXIT_FAILURE, "xshmfence_init: sem_open"); } @@ -223,13 +223,13 @@ xshmfence_close_semaphore(struct xshmfence *f) } static sem_t * -mksemtemp(char *name, const char *template) +mksemtemp(char *name, size_t namelen, const char *template) { sem_t *ret; pid_t p; p = getpid(); for(;;) { - sprintf(name, template, p); + snprintf(name, namelen, template, p); ret = sem_open(name, O_CREAT|O_EXCL, 0600, 1); if (ret == SEM_FAILED) { if (errno == EEXIST) { |