pkgsrc-Changes archive

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

CVS commit: pkgsrc/x11/libxshmfence



Module Name:    pkgsrc
Committed By:   tnn
Date:           Wed Aug 24 07:16:22 UTC 2016

Modified Files:
        pkgsrc/x11/libxshmfence: Makefile
        pkgsrc/x11/libxshmfence/files: xshmfence_semaphore.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 pkgsrc/x11/libxshmfence/Makefile
cvs rdiff -u -r1.5 -r1.6 pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/x11/libxshmfence/Makefile
diff -u pkgsrc/x11/libxshmfence/Makefile:1.6 pkgsrc/x11/libxshmfence/Makefile:1.7
--- pkgsrc/x11/libxshmfence/Makefile:1.6        Wed May  4 02:54:46 2016
+++ pkgsrc/x11/libxshmfence/Makefile    Wed Aug 24 07:16:22 2016
@@ -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

Index: pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c
diff -u pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c:1.5 pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c:1.6
--- pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c:1.5     Wed May  4 02:54:46 2016
+++ pkgsrc/x11/libxshmfence/files/xshmfence_semaphore.c Wed Aug 24 07:16:22 2016
@@ -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 xshmfen
 }
 
 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