pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/x11/libxshmfence Change an sprintf to snprintf in atte...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/39b8ddbef7d0
branches:  trunk
changeset: 351635:39b8ddbef7d0
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Wed Aug 24 07:16:22 2016 +0000

description:
Change an sprintf to snprintf in attempt to appease stack protector.
No functional change; the buffer is large enough.

diffstat:

 x11/libxshmfence/Makefile                    |   4 ++--
 x11/libxshmfence/files/xshmfence_semaphore.c |  10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r f38dbfccb2f3 -r 39b8ddbef7d0 x11/libxshmfence/Makefile
--- a/x11/libxshmfence/Makefile Wed Aug 24 06:39:00 2016 +0000
+++ b/x11/libxshmfence/Makefile Wed Aug 24 07:16:22 2016 +0000
@@ -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 -r f38dbfccb2f3 -r 39b8ddbef7d0 x11/libxshmfence/files/xshmfence_semaphore.c
--- a/x11/libxshmfence/files/xshmfence_semaphore.c      Wed Aug 24 06:39:00 2016 +0000
+++ b/x11/libxshmfence/files/xshmfence_semaphore.c      Wed Aug 24 07:16:22 2016 +0000
@@ -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 @@
        __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 @@
 }
 
 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) {



Home | Main Index | Thread Index | Old Index