Merge remote-tracking branch 'openwrt/master' into gstreamer1

This commit is contained in:
W. Michael Petullo 2014-08-05 17:47:34 -04:00
commit 6c9015eb5d
36 changed files with 1829 additions and 620 deletions

View File

@ -11,9 +11,9 @@ PKG_NAME:=patch
PKG_VERSION:=2.7.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/patch
PKG_MD5SUM:=95dd8d7e41dcbcecdd5cd88ef915378d
PKG_MD5SUM:=e9ae5393426d3ad783a300a338c09b72
include $(INCLUDE_DIR)/package.mk

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gnutls
PKG_VERSION:=3.2.15
PKG_VERSION:=3.2.16
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2
PKG_MD5SUM:=ec3b06f80e312137386c5d322183ca5a
PKG_MD5SUM:=d9a3fb49121b49bc332bfe9c3f49b005
PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
PKG_INSTALL:=1

View File

@ -1,28 +0,0 @@
diff --git a/lib/accelerated/x86/x86-common.h b/lib/accelerated/x86/x86-common.h
index 03fc8de..647c7d6 100644
--- a/lib/accelerated/x86/x86-common.h
+++ b/lib/accelerated/x86/x86-common.h
@@ -29,11 +29,13 @@ extern unsigned int _gnutls_x86_cpuid_s[4];
void gnutls_cpuid(unsigned int func, unsigned int *ax, unsigned int *bx,
unsigned int *cx, unsigned int *dx);
-#ifdef ASM_X86_32
+# ifdef ASM_X86_32
unsigned int gnutls_have_cpuid(void);
-#else
-#define gnutls_have_cpuid() 1
-#endif /* ASM_X86_32 */
+# else
+# define gnutls_have_cpuid() 1
+# endif /* ASM_X86_32 */
+
+#endif
#define NN_HASH(name, update_func, digest_func, NAME) { \
#name, \
@@ -44,5 +46,3 @@ unsigned int gnutls_have_cpuid(void);
(nettle_hash_update_func *) update_func, \
(nettle_hash_digest_func *) digest_func \
}
-
-#endif

View File

@ -1,98 +0,0 @@
#
# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=gsm
PKG_VERSION:=1.0.13
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://user.cs.tu-berlin.de/~jutta/gsm/
PKG_MD5SUM:=c1ba392ce61dc4aff1c29ea4e92f6df4
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
PKG_LICENSE:=FREE
PKG_LICENSE_FILES:=COPYRIGHT
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-1.0-pl13
include $(INCLUDE_DIR)/package.mk
define Package/gsm/Default
TITLE:=GSM transcoding
URL:=http://user.cs.tu-berlin.de/~jutta/toast.html
endef
define Package/gsm/description/Default
An implementation of the European GSM 06.10 provisional standard
for full-rate speech transcoding, prI-ETS 300 036, which uses
RPE/LTP (residual pulse excitation/long term prediction) coding
at 13 kbit/s.
endef
define Package/libgsm
$(call Package/gsm/Default)
SECTION:=libs
CATEGORY:=Libraries
TITLE+= library
endef
define Package/libgsm/description
$(call Package/gsm/description/Default)
This package contains a shared GSM transcoding library, used by other
programs.
endef
define Package/gsm-utils
$(call Package/gsm/Default)
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libgsm
TITLE+= utilities
endef
define Package/gsm-utils/description
$(call Package/gsm/description/Default)
This package contains GSM transcoding utilities.
endef
define Build/Configure
endef
TARGET_CFLAGS += $(FPIC)
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
LD="$(TARGET_CC)" \
COPTS="$(TARGET_CFLAGS)" \
INSTALL_ROOT="$(PKG_INSTALL_DIR)" \
all install
endef
define Package/libgsm/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsm.so.* $(1)/usr/lib/
endef
define Package/gsm-utils/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/toast $(1)/usr/bin/
(cd $(1)/usr/bin; ln -sf toast untoast; ln -sf toast tcat)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/gsm
$(CP) $(PKG_INSTALL_DIR)/usr/include/gsm.h $(1)/usr/include/gsm/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsm.{a,so*} $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libgsm))
$(eval $(call BuildPackage,gsm-utils))

View File

@ -1,428 +0,0 @@
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,12 @@ SASR = -DSASR
######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
# MULHACK = -DUSE_FLOAT_MUL
+MULHACK =
######### Define this if your host multiplies floats faster than integers,
######### e.g. on a SPARCstation.
# FAST = -DFAST
+FAST =
######### Define together with USE_FLOAT_MUL to enable the GSM library's
######### approximation option for incorrect, but good-enough results.
@@ -22,8 +24,8 @@ LTP_CUT =
######### both integer and floating point multiplications.
######### This flag is still in the experimental stage.
-WAV49 = -DWAV49
-# WAV49 =
+# WAV49 = -DWAV49
+WAV49 =
######### Define to enable the GSM library's option to pack GSM frames
######### in the style used by the WAV #49 format. If you want to write
######### a tool that produces .WAV files which contain GSM-encoded data,
@@ -44,7 +46,8 @@ WAV49 = -DWAV49
# CCFLAGS = -c -O
CC = gcc -ansi -pedantic
-CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1
+COPTS = -O2
+CCFLAGS = -c $(COPTS) -DNeedFunctionPrototypes=1
LD = $(CC)
@@ -78,10 +81,10 @@ INSTALL_ROOT =
# Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
# this directory.
-GSM_INSTALL_ROOT = $(INSTALL_ROOT)
+GSM_INSTALL_ROOT = $(INSTALL_ROOT)/usr
GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
# Where do you want to install the toast binaries and their manpage?
@@ -89,14 +92,14 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/ma
# Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
# of this directory.
-TOAST_INSTALL_ROOT = $(INSTALL_ROOT)
+TOAST_INSTALL_ROOT = $(INSTALL_ROOT)/usr
TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
-TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
+TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1
# Other tools
SHELL = /bin/sh
-LN = ln
+LN = ln -s
BASENAME = basename
AR = ar
ARFLAGS = cr
@@ -126,7 +129,7 @@ INC = $(ROOT)/inc
# Flags
-# DEBUG = -DNDEBUG
+DEBUG = -DNDEBUG
######### Remove -DNDEBUG to enable assertions.
CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
@@ -140,6 +143,7 @@ LFLAGS = $(LDFLAGS) $(LDINC)
# Targets
LIBGSM = $(LIB)/libgsm.a
+LIBGSMSO= $(LIB)/libgsm.so
TOAST = $(BIN)/toast
UNTOAST = $(BIN)/untoast
@@ -258,6 +262,9 @@ STUFF = ChangeLog \
GSM_INSTALL_TARGETS = \
$(GSM_INSTALL_LIB)/libgsm.a \
+ $(GSM_INSTALL_LIB)/libgsm.so \
+ $(GSM_INSTALL_LIB)/libgsm.so.1 \
+ $(GSM_INSTALL_LIB)/libgsm.so.1.0.10 \
$(GSM_INSTALL_INC)/gsm.h \
$(GSM_INSTALL_MAN)/gsm.3 \
$(GSM_INSTALL_MAN)/gsm_explode.3 \
@@ -279,7 +286,7 @@ TOAST_INSTALL_TARGETS = \
# Target rules
-all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
@-echo $(ROOT): Done.
tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,6 +306,11 @@ install: toastinstall gsminstall
# The basic API: libgsm
+$(LIBGSMSO): $(LIB) $(GSM_OBJECTS)
+ $(LD) -o $@.1.0.10 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
+ ln -fs libgsm.so.1.0.10 lib/libgsm.so.1
+ ln -fs libgsm.so.1.0.10 lib/libgsm.so
+
$(LIBGSM): $(LIB) $(GSM_OBJECTS)
-rm $(RMFLAGS) $(LIBGSM)
$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
@@ -308,15 +320,15 @@ $(LIBGSM): $(LIB) $(GSM_OBJECTS)
# Toast, Untoast and Tcat -- the compress-like frontends to gsm.
$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
- $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+ $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
$(UNTOAST): $(BIN) $(TOAST)
-rm $(RMFLAGS) $(UNTOAST)
- $(LN) $(TOAST) $(UNTOAST)
+ $(LN) toast $(UNTOAST)
$(TCAT): $(BIN) $(TOAST)
-rm $(RMFLAGS) $(TCAT)
- $(LN) $(TOAST) $(TCAT)
+ $(LN) toast $(TCAT)
# The local bin and lib directories
@@ -351,53 +363,66 @@ toastuninstall:
fi
$(TOAST_INSTALL_BIN)/toast: $(TOAST)
- -rm $@
- cp $(TOAST) $@
+ mkdir -p $(TOAST_INSTALL_BIN)
+ cp -f $(TOAST) $@
chmod 755 $@
$(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast
- -rm $@
- ln $? $@
+ mkdir -p $(TOAST_INSTALL_BIN)
+ ln -sf $? $@
$(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast
- -rm $@
- ln $? $@
+ mkdir -p $(TOAST_INSTALL_BIN)
+ ln -sf $? $@
$(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1
- -rm $@
- cp $? $@
+ mkdir -p $(TOAST_INSTALL_MAN)
+ cp -f $? $@
chmod 444 $@
$(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3
- -rm $@
- cp $? $@
+ mkdir -p $(GSM_INSTALL_MAN)
+ cp -f $? $@
chmod 444 $@
$(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3
- -rm $@
- cp $? $@
+ mkdir -p $(GSM_INSTALL_MAN)
+ cp -f $? $@
chmod 444 $@
$(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3
- -rm $@
- cp $? $@
+ mkdir -p $(GSM_INSTALL_MAN)
+ cp -f $? $@
chmod 444 $@
$(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
- -rm $@
- cp $? $@
+ mkdir -p $(GSM_INSTALL_MAN)
+ cp -f $? $@
chmod 444 $@
$(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h
- -rm $@
- cp $? $@
+ mkdir -p $(GSM_INSTALL_INC)
+ cp -f $? $@
chmod 444 $@
$(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM)
- -rm $@
- cp $? $@
+ mkdir -p $(GSM_INSTALL_LIB)
+ cp -f $? $@
chmod 444 $@
+$(GSM_INSTALL_LIB)/libgsm.so: $(LIBGSMSO)
+ mkdir -p $(GSM_INSTALL_LIB)
+ cp -f $? $@
+
+$(GSM_INSTALL_LIB)/libgsm.so.1: $(LIBGSMSO)
+ mkdir -p $(GSM_INSTALL_LIB)
+ cp -f $? $@
+
+$(GSM_INSTALL_LIB)/libgsm.so.1.0.10: $(LIBGSMSO)
+ mkdir -p $(GSM_INSTALL_LIB)
+ cp -f $? $@
+ chmod 755 $@
+
# Distribution
@@ -426,7 +451,9 @@ semi-clean:
clean: semi-clean
-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
- $(TOAST) $(TCAT) $(UNTOAST) \
+ $(LIBGSMSO) $(LIB)/libgsm.so.1.0.10 \
+ $(LIB)libgsm.so.1 \
+ $(TOAST) $(TCAT) $(UNTOAST) \
$(ROOT)/gsm-1.0.tar.Z
--- a/inc/config.h
+++ b/inc/config.h
@@ -9,8 +9,8 @@
#ifndef CONFIG_H
#define CONFIG_H
-/*efine SIGHANDLER_T int /* signal handlers are void */
-/*efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */
+/*efine SIGHANDLER_T int *//* signal handlers are void */
+/*efine HAS_SYSV_SIGNAL 1 *//* sigs not blocked/reset? */
#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */
#define HAS_LIMITS_H 1 /* /usr/include/limits.h */
@@ -22,16 +22,16 @@
#define HAS_CHMOD 1 /* chmod syscall */
#define HAS_FCHOWN 1 /* fchown syscall */
#define HAS_CHOWN 1 /* chown syscall */
-/*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */
+/*efine HAS__FSETMODE 1 *//* _fsetmode -- set file mode */
#define HAS_STRING_H 1 /* /usr/include/string.h */
-/*efine HAS_STRINGS_H 1 /* /usr/include/strings.h */
+/*efine HAS_STRINGS_H 1 *//* /usr/include/strings.h */
#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */
#define HAS_UTIME 1 /* POSIX utime(path, times) */
-/*efine HAS_UTIMES 1 /* use utimes() syscall instead */
+/*efine HAS_UTIMES 1 *//* use utimes() syscall instead */
#define HAS_UTIME_H 1 /* UTIME header file */
#define HAS_UTIMBUF 1 /* struct utimbuf */
-/*efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */
+/*efine HAS_UTIMEUSEC 1 *//* microseconds in utimbuf? */
#endif /* CONFIG_H */
--- a/inc/gsm.h
+++ b/inc/gsm.h
@@ -54,6 +54,10 @@ typedef gsm_byte gsm_frame[33]; /* 33
#define GSM_OPT_FRAME_INDEX 5
#define GSM_OPT_FRAME_CHAIN 6
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern gsm gsm_create GSM_P((void));
extern void gsm_destroy GSM_P((gsm));
@@ -66,6 +70,10 @@ extern int gsm_decode GSM_P((gsm, gsm_
extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *));
extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *));
+#ifdef __cplusplus
+}
+#endif
+
#undef GSM_P
#endif /* GSM_H */
--- a/inc/toast.h
+++ b/inc/toast.h
@@ -16,11 +16,12 @@
#include <stdio.h>
#include <ctype.h>
+#include <pthread.h>
#include <signal.h>
#include <errno.h>
-#ifndef HAS_ERRNO_DECL
- extern int errno;
+#ifndef errno
+ extern int errno;
#endif
#ifdef HAS_LIMITS_H
@@ -37,6 +38,10 @@
# endif
#endif
+#ifdef HAS_STDIO_H
+# include <stdio.h>
+#endif
+
#include "gsm.h"
#ifndef S_ISREG
--- a/src/code.c
+++ b/src/code.c
@@ -9,8 +9,8 @@
#include "config.h"
-#ifdef HAS_STDLIB_H
-#include <stdlib.h>
+#ifdef HAS_STRING_H
+#include <string.h>
#else
# include "proto.h"
extern char * memcpy P((char *, char *, int));
--- a/src/debug.c
+++ b/src/debug.c
@@ -49,7 +49,7 @@ void gsm_debug_longwords P4( (name, from
fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
while (from <= to) {
- fprintf(stderr, "%d ", ptr[ from ] );
+ fprintf(stderr, "%ld ", ptr[ from ] );
from++;
if (nprinted++ >= 7) {
nprinted = 0;
@@ -63,14 +63,14 @@ void gsm_debug_longword P2( (name, valu
char * name,
longword value )
{
- fprintf(stderr, "%s: %d\n", name, (long)value );
+ fprintf(stderr, "%s: %ld\n", name, (long)value );
}
void gsm_debug_word P2( (name, value),
char * name,
word value )
{
- fprintf(stderr, "%s: %d\n", name, (long)value);
+ fprintf(stderr, "%s: %ld\n", name, (long)value);
}
#endif
--- a/src/toast.c
+++ b/src/toast.c
@@ -251,8 +251,8 @@ static char * emalloc P1((len), size_t l
{
char * s;
if (!(s = malloc(len))) {
- fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
- progname, len);
+ fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n",
+ progname, (long) len);
onintr();
exit(1);
}
@@ -270,7 +270,7 @@ static char* normalname P3((name, want,
maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
p = strcpy(emalloc(maxlen), name);
- if (s = suffix(p, cut)) strcpy(s, want);
+ if ((s = suffix(p, cut))) strcpy(s, want);
else if (*want && !suffix(p, want)) strcat(p, want);
return p;
@@ -386,7 +386,7 @@ static void update_times P0()
ut[0] = instat.st_atime;
ut[1] = instat.st_mtime;
- (void) utime(outname, ut);
+ (void) utime(outname, (struct utimbuf *)ut);
#endif /* UTIMBUF */
}
@@ -416,7 +416,7 @@ static int okay_as_input P3((name,f,st),
}
if (st->st_nlink > 1 && !f_cat && !f_precious) {
fprintf(stderr,
- "%s: \"%s\" has %s other link%s -- unchanged.\n",
+ "%s: \"%s\" has %d other link%s -- unchanged.\n",
progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2));
return 0;
}
@@ -585,8 +585,8 @@ static int process_decode P0()
if (cc != sizeof(s)) {
if (cc >= 0) fprintf(stderr,
- "%s: incomplete frame (%d byte%s missing) from %s\n",
- progname, sizeof(s) - cc,
+ "%s: incomplete frame (%ld byte%s missing) from %s\n",
+ progname, (long) sizeof(s) - cc,
"s" + (sizeof(s) - cc == 1),
inname ? inname : "stdin" );
gsm_destroy(r);
@@ -624,8 +624,6 @@ static int process_decode P0()
static int process P1((name), char * name)
{
- int step = 0;
-
out = (FILE *)0;
in = (FILE *)0;
@@ -779,7 +777,6 @@ int main P2((ac, av), int ac, char **av)
case 'h': help(); exit(0);
default:
- usage:
fprintf(stderr,
"Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n",
progname);

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=tiff
PKG_VERSION:=4.0.3
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://download.osgeo.org/libtiff

View File

@ -0,0 +1,31 @@
Index: tiff-4.0.3/tools/ppm2tiff.c
===================================================================
--- tiff-4.0.3.orig/tools/ppm2tiff.c 2013-06-23 10:36:50.779629492 -0400
+++ tiff-4.0.3/tools/ppm2tiff.c 2013-06-23 10:36:50.775629494 -0400
@@ -89,6 +89,7 @@
int c;
extern int optind;
extern char* optarg;
+ tmsize_t scanline_size;
if (argc < 2) {
fprintf(stderr, "%s: Too few arguments\n", argv[0]);
@@ -237,8 +238,16 @@
}
if (TIFFScanlineSize(out) > linebytes)
buf = (unsigned char *)_TIFFmalloc(linebytes);
- else
- buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
+ else {
+ scanline_size = TIFFScanlineSize(out);
+ if (scanline_size != 0)
+ buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
+ else {
+ fprintf(stderr, "%s: scanline size overflow\n",infile);
+ (void) TIFFClose(out);
+ exit(-2);
+ }
+ }
if (resolution > 0) {
TIFFSetField(out, TIFFTAG_XRESOLUTION, resolution);
TIFFSetField(out, TIFFTAG_YRESOLUTION, resolution);

View File

@ -0,0 +1,146 @@
Index: tiff-4.0.3/tools/tiff2pdf.c
===================================================================
--- tiff-4.0.3.orig/tools/tiff2pdf.c 2013-06-23 10:36:50.979629486 -0400
+++ tiff-4.0.3/tools/tiff2pdf.c 2013-06-23 10:36:50.975629486 -0400
@@ -3341,33 +3341,56 @@
uint32 height){
tsize_t i=0;
- uint16 ri =0;
- uint16 v_samp=1;
- uint16 h_samp=1;
- int j=0;
-
- i++;
-
- while(i<(*striplength)){
+
+ while (i < *striplength) {
+ tsize_t datalen;
+ uint16 ri;
+ uint16 v_samp;
+ uint16 h_samp;
+ int j;
+ int ncomp;
+
+ /* marker header: one or more FFs */
+ if (strip[i] != 0xff)
+ return(0);
+ i++;
+ while (i < *striplength && strip[i] == 0xff)
+ i++;
+ if (i >= *striplength)
+ return(0);
+ /* SOI is the only pre-SOS marker without a length word */
+ if (strip[i] == 0xd8)
+ datalen = 0;
+ else {
+ if ((*striplength - i) <= 2)
+ return(0);
+ datalen = (strip[i+1] << 8) | strip[i+2];
+ if (datalen < 2 || datalen >= (*striplength - i))
+ return(0);
+ }
switch( strip[i] ){
- case 0xd8:
- /* SOI - start of image */
+ case 0xd8: /* SOI - start of image */
_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), 2);
*bufferoffset+=2;
- i+=2;
break;
- case 0xc0:
- case 0xc1:
- case 0xc3:
- case 0xc9:
- case 0xca:
+ case 0xc0: /* SOF0 */
+ case 0xc1: /* SOF1 */
+ case 0xc3: /* SOF3 */
+ case 0xc9: /* SOF9 */
+ case 0xca: /* SOF10 */
if(no==0){
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);
- for(j=0;j<buffer[*bufferoffset+9];j++){
- if( (buffer[*bufferoffset+11+(2*j)]>>4) > h_samp)
- h_samp = (buffer[*bufferoffset+11+(2*j)]>>4);
- if( (buffer[*bufferoffset+11+(2*j)] & 0x0f) > v_samp)
- v_samp = (buffer[*bufferoffset+11+(2*j)] & 0x0f);
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2);
+ ncomp = buffer[*bufferoffset+9];
+ if (ncomp < 1 || ncomp > 4)
+ return(0);
+ v_samp=1;
+ h_samp=1;
+ for(j=0;j<ncomp;j++){
+ uint16 samp = buffer[*bufferoffset+11+(3*j)];
+ if( (samp>>4) > h_samp)
+ h_samp = (samp>>4);
+ if( (samp & 0x0f) > v_samp)
+ v_samp = (samp & 0x0f);
}
v_samp*=8;
h_samp*=8;
@@ -3381,45 +3404,43 @@
(unsigned char) ((height>>8) & 0xff);
buffer[*bufferoffset+6]=
(unsigned char) (height & 0xff);
- *bufferoffset+=strip[i+2]+2;
- i+=strip[i+2]+2;
-
+ *bufferoffset+=datalen+2;
+ /* insert a DRI marker */
buffer[(*bufferoffset)++]=0xff;
buffer[(*bufferoffset)++]=0xdd;
buffer[(*bufferoffset)++]=0x00;
buffer[(*bufferoffset)++]=0x04;
buffer[(*bufferoffset)++]=(ri >> 8) & 0xff;
buffer[(*bufferoffset)++]= ri & 0xff;
- } else {
- i+=strip[i+2]+2;
}
break;
- case 0xc4:
- case 0xdb:
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);
- *bufferoffset+=strip[i+2]+2;
- i+=strip[i+2]+2;
+ case 0xc4: /* DHT */
+ case 0xdb: /* DQT */
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2);
+ *bufferoffset+=datalen+2;
break;
- case 0xda:
+ case 0xda: /* SOS */
if(no==0){
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);
- *bufferoffset+=strip[i+2]+2;
- i+=strip[i+2]+2;
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2);
+ *bufferoffset+=datalen+2;
} else {
buffer[(*bufferoffset)++]=0xff;
buffer[(*bufferoffset)++]=
(unsigned char)(0xd0 | ((no-1)%8));
- i+=strip[i+2]+2;
}
- _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), (*striplength)-i-1);
- *bufferoffset+=(*striplength)-i-1;
+ i += datalen + 1;
+ /* copy remainder of strip */
+ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i]), *striplength - i);
+ *bufferoffset+= *striplength - i;
return(1);
default:
- i+=strip[i+2]+2;
+ /* ignore any other marker */
+ break;
}
+ i += datalen + 1;
}
-
+ /* failed to find SOS marker */
return(0);
}
#endif

View File

@ -0,0 +1,768 @@
Index: tiff-4.0.3/contrib/dbs/xtiff/xtiff.c
===================================================================
--- tiff-4.0.3.orig/contrib/dbs/xtiff/xtiff.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/contrib/dbs/xtiff/xtiff.c 2013-06-23 10:36:51.147629484 -0400
@@ -512,9 +512,9 @@
Arg args[1];
if (tfMultiPage)
- sprintf(buffer, "%s - page %d", fileName, tfDirectory);
+ snprintf(buffer, sizeof(buffer), "%s - page %d", fileName, tfDirectory);
else
- strcpy(buffer, fileName);
+ snprintf(buffer, sizeof(buffer), "%s", fileName);
XtSetArg(args[0], XtNlabel, buffer);
XtSetValues(labelWidget, args, 1);
}
Index: tiff-4.0.3/libtiff/tif_dirinfo.c
===================================================================
--- tiff-4.0.3.orig/libtiff/tif_dirinfo.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/libtiff/tif_dirinfo.c 2013-06-23 10:36:51.147629484 -0400
@@ -711,7 +711,7 @@
* note that this name is a special sign to TIFFClose() and
* _TIFFSetupFields() to free the field
*/
- sprintf(fld->field_name, "Tag %d", (int) tag);
+ snprintf(fld->field_name, 32, "Tag %d", (int) tag);
return fld;
}
Index: tiff-4.0.3/libtiff/tif_codec.c
===================================================================
--- tiff-4.0.3.orig/libtiff/tif_codec.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/libtiff/tif_codec.c 2013-06-23 10:36:51.151629482 -0400
@@ -108,7 +108,8 @@
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
char compression_code[20];
- sprintf( compression_code, "%d", tif->tif_dir.td_compression );
+ snprintf(compression_code, sizeof(compression_code), "%d",
+ tif->tif_dir.td_compression );
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"%s compression support is not configured",
c ? c->name : compression_code );
Index: tiff-4.0.3/tools/tiffdither.c
===================================================================
--- tiff-4.0.3.orig/tools/tiffdither.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/tools/tiffdither.c 2013-06-23 10:36:51.151629482 -0400
@@ -260,7 +260,7 @@
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
else
CopyField(TIFFTAG_FILLORDER, shortv);
- sprintf(thing, "Dithered B&W version of %s", argv[optind]);
+ snprintf(thing, sizeof(thing), "Dithered B&W version of %s", argv[optind]);
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
CopyField(TIFFTAG_PHOTOMETRIC, shortv);
CopyField(TIFFTAG_ORIENTATION, shortv);
Index: tiff-4.0.3/tools/rgb2ycbcr.c
===================================================================
--- tiff-4.0.3.orig/tools/rgb2ycbcr.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/tools/rgb2ycbcr.c 2013-06-23 10:36:51.151629482 -0400
@@ -332,7 +332,8 @@
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
{ char buf[2048];
char *cp = strrchr(TIFFFileName(in), '/');
- sprintf(buf, "YCbCr conversion of %s", cp ? cp+1 : TIFFFileName(in));
+ snprintf(buf, sizeof(buf), "YCbCr conversion of %s",
+ cp ? cp+1 : TIFFFileName(in));
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, buf);
}
TIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion());
Index: tiff-4.0.3/tools/tiff2pdf.c
===================================================================
--- tiff-4.0.3.orig/tools/tiff2pdf.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/tools/tiff2pdf.c 2013-06-23 10:36:51.151629482 -0400
@@ -3630,7 +3630,9 @@
char buffer[16];
int buflen=0;
- buflen=sprintf(buffer, "%%PDF-%u.%u ", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff);
+ buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%u.%u ",
+ t2p->pdf_majorversion&0xff,
+ t2p->pdf_minorversion&0xff);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t)"\n%\342\343\317\323\n", 7);
@@ -3644,10 +3646,10 @@
tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
- buflen=sprintf(buffer, "%lu", (unsigned long)number);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
written += t2pWriteFile(output, (tdata_t) buffer, buflen );
written += t2pWriteFile(output, (tdata_t) " 0 obj\n", 7);
@@ -3686,13 +3688,13 @@
written += t2pWriteFile(output, (tdata_t) "/", 1);
for (i=0;i<namelen;i++){
if ( ((unsigned char)name[i]) < 0x21){
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
nextchar=1;
}
if ( ((unsigned char)name[i]) > 0x7E){
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
nextchar=1;
@@ -3700,57 +3702,57 @@
if (nextchar==0){
switch (name[i]){
case 0x23:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x25:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x28:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x29:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x2F:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x3C:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x3E:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x5B:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x5D:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x7B:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
case 0x7D:
- sprintf(buffer, "#%.2X", name[i]);
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
buffer[sizeof(buffer) - 1] = '\0';
written += t2pWriteFile(output, (tdata_t) buffer, 3);
break;
@@ -3865,14 +3867,14 @@
tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
written += t2pWriteFile(output, (tdata_t) "/Length ", 8);
if(len!=0){
written += t2p_write_pdf_stream_length(len, output);
} else {
- buflen=sprintf(buffer, "%lu", (unsigned long)number);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
}
@@ -3913,10 +3915,10 @@
tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
- buflen=sprintf(buffer, "%lu", (unsigned long)len);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)len);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "\n", 1);
@@ -3930,7 +3932,7 @@
tsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output)
{
tsize_t written = 0;
- char buffer[16];
+ char buffer[32];
int buflen = 0;
written += t2pWriteFile(output,
@@ -3969,7 +3971,6 @@
written += t2p_write_pdf_string(t2p->pdf_datetime, output);
}
written += t2pWriteFile(output, (tdata_t) "\n/Producer ", 11);
- _TIFFmemset((tdata_t)buffer, 0x00, sizeof(buffer));
snprintf(buffer, sizeof(buffer), "libtiff / tiff2pdf - %d", TIFFLIB_VERSION);
written += t2p_write_pdf_string(buffer, output);
written += t2pWriteFile(output, (tdata_t) "\n", 1);
@@ -4110,7 +4111,7 @@
{
tsize_t written=0;
tdir_t i=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
int page=0;
@@ -4118,7 +4119,7 @@
(tdata_t) "<< \n/Type /Pages \n/Kids [ ", 26);
page = t2p->pdf_pages+1;
for (i=0;i<t2p->tiff_pagecount;i++){
- buflen=sprintf(buffer, "%d", page);
+ buflen=snprintf(buffer, sizeof(buffer), "%d", page);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
if ( ((i+1)%8)==0 ) {
@@ -4133,8 +4134,7 @@
}
}
written += t2pWriteFile(output, (tdata_t) "] \n/Count ", 10);
- _TIFFmemset(buffer, 0x00, 16);
- buflen=sprintf(buffer, "%d", t2p->tiff_pagecount);
+ buflen=snprintf(buffer, sizeof(buffer), "%d", t2p->tiff_pagecount);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " \n>> \n", 6);
@@ -4149,28 +4149,28 @@
unsigned int i=0;
tsize_t written=0;
- char buffer[16];
+ char buffer[256];
int buflen=0;
written += t2pWriteFile(output, (tdata_t) "<<\n/Type /Page \n/Parent ", 24);
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_pages);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
written += t2pWriteFile(output, (tdata_t) "/MediaBox [", 11);
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x1);
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x1);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " ", 1);
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y1);
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y1);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " ", 1);
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x2);
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x2);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " ", 1);
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y2);
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y2);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "] \n", 3);
written += t2pWriteFile(output, (tdata_t) "/Contents ", 10);
- buflen=sprintf(buffer, "%lu", (unsigned long)(object + 1));
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(object + 1));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
written += t2pWriteFile(output, (tdata_t) "/Resources << \n", 15);
@@ -4178,15 +4178,13 @@
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
- buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "_", 1);
- buflen = sprintf(buffer, "%u", i+1);
+ buflen = snprintf(buffer, sizeof(buffer), "%u", i+1);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " ", 1);
- buflen = sprintf(
- buffer,
- "%lu",
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
@@ -4198,12 +4196,10 @@
} else {
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
- buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " ", 1);
- buflen = sprintf(
- buffer,
- "%lu",
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
@@ -4212,9 +4208,7 @@
if(t2p->tiff_transferfunctioncount != 0) {
written += t2pWriteFile(output, (tdata_t) "/ExtGState <<", 13);
t2pWriteFile(output, (tdata_t) "/GS1 ", 5);
- buflen = sprintf(
- buffer,
- "%lu",
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)(object + 3));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
@@ -4587,7 +4581,7 @@
if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){
box=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box;
- buflen=sprintf(buffer,
+ buflen=snprintf(buffer, sizeof(buffer),
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\n",
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
box.mat[0],
@@ -4602,7 +4596,7 @@
}
} else {
box=t2p->pdf_imagebox;
- buflen=sprintf(buffer,
+ buflen=snprintf(buffer, sizeof(buffer),
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\n",
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
box.mat[0],
@@ -4627,59 +4621,48 @@
TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);
written += t2pWriteFile(output,
(tdata_t) "/Type /XObject \n/Subtype /Image \n/Name /Im",
42);
- buflen=sprintf(buffer, "%u", t2p->pdf_page+1);
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
if(tile != 0){
written += t2pWriteFile(output, (tdata_t) "_", 1);
- buflen=sprintf(buffer, "%lu", (unsigned long)tile);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)tile);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
}
written += t2pWriteFile(output, (tdata_t) "\n/Width ", 8);
- _TIFFmemset((tdata_t)buffer, 0x00, 16);
if(tile==0){
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_width);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_width);
} else {
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
} else {
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
}
}
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "\n/Height ", 9);
- _TIFFmemset((tdata_t)buffer, 0x00, 16);
if(tile==0){
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_length);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_length);
} else {
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
} else {
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
}
}
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "\n/BitsPerComponent ", 19);
- _TIFFmemset((tdata_t)buffer, 0x00, 16);
- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "\n/ColorSpace ", 13);
written += t2p_write_pdf_xobject_cs(t2p, output);
@@ -4723,11 +4706,10 @@
t2p->pdf_colorspace ^= T2P_CS_PALETTE;
written += t2p_write_pdf_xobject_cs(t2p, output);
t2p->pdf_colorspace |= T2P_CS_PALETTE;
- buflen=sprintf(buffer, "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
+ buflen=snprintf(buffer, sizeof(buffer), "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " ", 1);
- _TIFFmemset(buffer, 0x00, 16);
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_palettecs );
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_palettecs );
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ]\n", 7);
return(written);
@@ -4761,10 +4743,10 @@
X_W /= Y_W;
Z_W /= Y_W;
Y_W = 1.0F;
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "/Range ", 7);
- buflen=sprintf(buffer, "[%d %d %d %d] \n",
+ buflen=snprintf(buffer, sizeof(buffer), "[%d %d %d %d] \n",
t2p->pdf_labrange[0],
t2p->pdf_labrange[1],
t2p->pdf_labrange[2],
@@ -4780,26 +4762,26 @@
tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
written += t2pWriteFile(output, (tdata_t) "<< /Type /ExtGState \n/TR ", 25);
if(t2p->tiff_transferfunctioncount == 1){
- buflen=sprintf(buffer, "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)(t2p->pdf_xrefcount + 1));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
} else {
written += t2pWriteFile(output, (tdata_t) "[ ", 2);
- buflen=sprintf(buffer, "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)(t2p->pdf_xrefcount + 1));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
- buflen=sprintf(buffer, "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)(t2p->pdf_xrefcount + 2));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
- buflen=sprintf(buffer, "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)(t2p->pdf_xrefcount + 3));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
@@ -4821,7 +4803,7 @@
written += t2pWriteFile(output, (tdata_t) "/FunctionType 0 \n", 17);
written += t2pWriteFile(output, (tdata_t) "/Domain [0.0 1.0] \n", 19);
written += t2pWriteFile(output, (tdata_t) "/Range [0.0 1.0] \n", 18);
- buflen=sprintf(buffer, "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
+ buflen=snprintf(buffer, sizeof(buffer), "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "/BitsPerSample 16 \n", 19);
written += t2p_write_pdf_stream_dict(((tsize_t)1)<<(t2p->tiff_bitspersample+1), 0, output);
@@ -4848,7 +4830,7 @@
tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
tsize_t written=0;
- char buffer[128];
+ char buffer[256];
int buflen=0;
float X_W=0.0;
@@ -4916,16 +4898,16 @@
written += t2pWriteFile(output, (tdata_t) "<< \n", 4);
if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "/Gamma 2.2 \n", 12);
}
if(t2p->pdf_colorspace & T2P_CS_CALRGB){
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "/Matrix ", 8);
- buflen=sprintf(buffer, "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
X_R, Y_R, Z_R,
X_G, Y_G, Z_G,
X_B, Y_B, Z_B);
@@ -4944,11 +4926,11 @@
tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
written += t2pWriteFile(output, (tdata_t) "[/ICCBased ", 11);
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_icccs);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_icccs);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R] \n", 7);
@@ -4958,11 +4940,11 @@
tsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
written += t2pWriteFile(output, (tdata_t) "/N ", 3);
- buflen=sprintf(buffer, "%u \n", t2p->tiff_samplesperpixel);
+ buflen=snprintf(buffer, sizeof(buffer), "%u \n", t2p->tiff_samplesperpixel);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "/Alternate ", 11);
t2p->pdf_colorspace ^= T2P_CS_ICCBASED;
@@ -5027,7 +5009,7 @@
tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){
tsize_t written=0;
- char buffer[16];
+ char buffer[32];
int buflen=0;
if(t2p->pdf_compression==T2P_COMPRESS_NONE){
@@ -5042,41 +5024,33 @@
written += t2pWriteFile(output, (tdata_t) "<< /K -1 ", 9);
if(tile==0){
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
- buflen=sprintf(buffer, "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_width);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
- buflen=sprintf(buffer, "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_length);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
} else {
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
} else {
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
}
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
} else {
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
- buflen=sprintf(
- buffer,
- "%lu",
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
}
@@ -5103,21 +5077,17 @@
if(t2p->pdf_compressionquality%100){
written += t2pWriteFile(output, (tdata_t) "/DecodeParms ", 13);
written += t2pWriteFile(output, (tdata_t) "<< /Predictor ", 14);
- _TIFFmemset(buffer, 0x00, 16);
- buflen=sprintf(buffer, "%u", t2p->pdf_compressionquality%100);
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_compressionquality%100);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " /Columns ", 10);
- _TIFFmemset(buffer, 0x00, 16);
- buflen = sprintf(buffer, "%lu",
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
(unsigned long)t2p->tiff_width);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " /Colors ", 9);
- _TIFFmemset(buffer, 0x00, 16);
- buflen=sprintf(buffer, "%u", t2p->tiff_samplesperpixel);
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_samplesperpixel);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " /BitsPerComponent ", 19);
- _TIFFmemset(buffer, 0x00, 16);
- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) ">>\n", 3);
}
@@ -5137,16 +5107,16 @@
tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){
tsize_t written=0;
- char buffer[21];
+ char buffer[64];
int buflen=0;
uint32 i=0;
written += t2pWriteFile(output, (tdata_t) "xref\n0 ", 7);
- buflen=sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " \n0000000000 65535 f \n", 22);
for (i=0;i<t2p->pdf_xrefcount;i++){
- sprintf(buffer, "%.10lu 00000 n \n",
+ snprintf(buffer, sizeof(buffer), "%.10lu 00000 n \n",
(unsigned long)t2p->pdf_xrefoffsets[i]);
written += t2pWriteFile(output, (tdata_t) buffer, 20);
}
@@ -5170,17 +5140,14 @@
snprintf(t2p->pdf_fileid + i, 9, "%.8X", rand());
written += t2pWriteFile(output, (tdata_t) "trailer\n<<\n/Size ", 17);
- buflen = sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
+ buflen = snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
- _TIFFmemset(buffer, 0x00, 32);
written += t2pWriteFile(output, (tdata_t) "\n/Root ", 7);
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_catalog);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_catalog);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
- _TIFFmemset(buffer, 0x00, 32);
written += t2pWriteFile(output, (tdata_t) " 0 R \n/Info ", 12);
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_info);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_info);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
- _TIFFmemset(buffer, 0x00, 32);
written += t2pWriteFile(output, (tdata_t) " 0 R \n/ID[<", 11);
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
sizeof(t2p->pdf_fileid) - 1);
@@ -5188,9 +5155,8 @@
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
sizeof(t2p->pdf_fileid) - 1);
written += t2pWriteFile(output, (tdata_t) ">]\n>>\nstartxref\n", 16);
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_startxref);
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_startxref);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
- _TIFFmemset(buffer, 0x00, 32);
written += t2pWriteFile(output, (tdata_t) "\n%%EOF\n", 7);
return(written);
Index: tiff-4.0.3/tools/tiff2ps.c
===================================================================
--- tiff-4.0.3.orig/tools/tiff2ps.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/tools/tiff2ps.c 2013-06-23 10:36:51.155629481 -0400
@@ -1781,8 +1781,8 @@
imageOp = "imagemask";
(void)strcpy(im_x, "0");
- (void)sprintf(im_y, "%lu", (long) h);
- (void)sprintf(im_h, "%lu", (long) h);
+ (void)snprintf(im_y, sizeof(im_y), "%lu", (long) h);
+ (void)snprintf(im_h, sizeof(im_h), "%lu", (long) h);
tile_width = w;
tile_height = h;
if (TIFFIsTiled(tif)) {
@@ -1803,7 +1803,7 @@
}
if (tile_height < h) {
fputs("/im_y 0 def\n", fd);
- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h);
}
} else {
repeat_count = tf_numberstrips;
@@ -1815,7 +1815,7 @@
fprintf(fd, "/im_h %lu def\n",
(unsigned long) tile_height);
(void)strcpy(im_h, "im_h");
- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h);
}
}
Index: tiff-4.0.3/tools/tiffcrop.c
===================================================================
--- tiff-4.0.3.orig/tools/tiffcrop.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/tools/tiffcrop.c 2013-06-23 10:36:51.159629481 -0400
@@ -2077,7 +2077,7 @@
return 1;
}
- sprintf (filenum, "-%03d%s", findex, export_ext);
+ snprintf(filenum, sizeof(filenum), "-%03d%s", findex, export_ext);
filenum[14] = '\0';
strncat (exportname, filenum, 15);
}
@@ -2230,8 +2230,8 @@
/* dump.infilename is guaranteed to be NUL termimated and have 20 bytes
fewer than PATH_MAX */
- memset (temp_filename, '\0', PATH_MAX + 1);
- sprintf (temp_filename, "%s-read-%03d.%s", dump.infilename, dump_images,
+ snprintf(temp_filename, sizeof(temp_filename), "%s-read-%03d.%s",
+ dump.infilename, dump_images,
(dump.format == DUMP_TEXT) ? "txt" : "raw");
if ((dump.infile = fopen(temp_filename, dump.mode)) == NULL)
{
@@ -2249,8 +2249,8 @@
/* dump.outfilename is guaranteed to be NUL termimated and have 20 bytes
fewer than PATH_MAX */
- memset (temp_filename, '\0', PATH_MAX + 1);
- sprintf (temp_filename, "%s-write-%03d.%s", dump.outfilename, dump_images,
+ snprintf(temp_filename, sizeof(temp_filename), "%s-write-%03d.%s",
+ dump.outfilename, dump_images,
(dump.format == DUMP_TEXT) ? "txt" : "raw");
if ((dump.outfile = fopen(temp_filename, dump.mode)) == NULL)
{
Index: tiff-4.0.3/tools/tiff2bw.c
===================================================================
--- tiff-4.0.3.orig/tools/tiff2bw.c 2013-06-23 10:36:51.163629483 -0400
+++ tiff-4.0.3/tools/tiff2bw.c 2013-06-23 10:36:51.159629481 -0400
@@ -205,7 +205,7 @@
}
}
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
- sprintf(thing, "B&W version of %s", argv[optind]);
+ snprintf(thing, sizeof(thing), "B&W version of %s", argv[optind]);
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
TIFFSetField(out, TIFFTAG_SOFTWARE, "tiff2bw");
outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));

View File

@ -0,0 +1,17 @@
Description: Buffer overflow in gif2tiff
Bug: http://bugzilla.maptools.org/show_bug.cgi?id=2450
Bug-Debian: http://bugs.debian.org/719303
Index: tiff-4.0.3/tools/gif2tiff.c
===================================================================
--- tiff-4.0.3.orig/tools/gif2tiff.c 2013-08-22 11:46:11.960846910 -0400
+++ tiff-4.0.3/tools/gif2tiff.c 2013-08-22 11:46:11.956846910 -0400
@@ -333,6 +333,8 @@
int status = 1;
datasize = getc(infile);
+ if (datasize > 12)
+ return 0;
clear = 1 << datasize;
eoi = clear + 1;
avail = clear + 2;

View File

@ -0,0 +1,18 @@
Description: use after free in tiff2pdf
Bug: http://bugzilla.maptools.org/show_bug.cgi?id=2449
Bug-Debian: http://bugs.debian.org/719303
Index: tiff-4.0.3/tools/tiff2pdf.c
===================================================================
--- tiff-4.0.3.orig/tools/tiff2pdf.c 2013-08-22 11:46:37.292847242 -0400
+++ tiff-4.0.3/tools/tiff2pdf.c 2013-08-22 11:46:37.292847242 -0400
@@ -2461,7 +2461,8 @@
(unsigned long) t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
- _TIFFfree(buffer);
+ _TIFFfree(buffer);
+ return(0);
} else {
buffer=samplebuffer;
t2p->tiff_datasize *= t2p->tiff_samplesperpixel;

View File

@ -0,0 +1,18 @@
Description: OOB write in gif2tiff
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=996468
Index: tiff-4.0.3/tools/gif2tiff.c
===================================================================
--- tiff-4.0.3.orig/tools/gif2tiff.c 2013-08-24 11:17:13.546447901 -0400
+++ tiff-4.0.3/tools/gif2tiff.c 2013-08-24 11:17:13.546447901 -0400
@@ -400,6 +400,10 @@
}
if (oldcode == -1) {
+ if (code >= clear) {
+ fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
+ return 0;
+ }
*(*fill)++ = suffix[code];
firstchar = oldcode = code;
return 1;

View File

@ -0,0 +1,37 @@
Index: tiff/tools/gif2tiff.c
===================================================================
--- tiff.orig/tools/gif2tiff.c
+++ tiff/tools/gif2tiff.c
@@ -280,6 +280,10 @@ readgifimage(char* mode)
fprintf(stderr, "no colormap present for image\n");
return (0);
}
+ if (width == 0 || height == 0) {
+ fprintf(stderr, "Invalid value of width or height\n");
+ return(0);
+ }
if ((raster = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {
fprintf(stderr, "not enough memory for image\n");
return (0);
@@ -404,6 +408,10 @@ process(register int code, unsigned char
fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
return 0;
}
+ if (*fill >= raster + width*height) {
+ fprintf(stderr, "raster full before eoi code\n");
+ return 0;
+ }
*(*fill)++ = suffix[code];
firstchar = oldcode = code;
return 1;
@@ -434,6 +442,10 @@ process(register int code, unsigned char
}
oldcode = incode;
do {
+ if (*fill >= raster + width*height) {
+ fprintf(stderr, "raster full before eoi code\n");
+ return 0;
+ }
*(*fill)++ = *--stackp;
} while (stackp > stack);
return 1;

View File

@ -14,7 +14,11 @@ PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/minidlna
PKG_MD5SUM:=879027192c89e5376cdd2ae2d1aa33b4
PKG_MAINTAINER:=Knyazkov Dmitry <medavedik@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILE:=COPYING
PKG_BUILD_PARALLEL:=0
PKG_BUILD_DEPENDS:=util-linux

View File

@ -0,0 +1,12 @@
--- a/upnphttp.c
+++ b/upnphttp.c
@@ -1259,7 +1259,7 @@
int try_sendfile = 1;
#endif
- while( offset < end_offset )
+ while( offset <= end_offset )
{
#if HAVE_SENDFILE
if( try_sendfile )

View File

@ -13,7 +13,7 @@ PKG_VERSION:=r$(PKG_REV)
PKG_RELEASE:=1
PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).1.tar.bz2
PKG_SOURCE_URL:=https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer-experimental
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=$(PKG_REV)

63
net/dhcpcd/Makefile Normal file
View File

@ -0,0 +1,63 @@
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=dhcpcd
PKG_VERSION:=6.4.3
PKG_RELEASE:=1
PKG_SOURCE_URL:=ftp://roy.marples.name/pub/dhcpcd \
http://roy.marples.name/downloads/dhcpcd
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_MD5SUM:=b22005c131e7108ecf598b6a4ac091eb
PKG_LICENSE:=BSD-2c
PKG_LICENSE_FILES:=
PKG_MAINTAINER:=Roy Marples <roy@marples.name>
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/dhcpcd
SECTION:=net
CATEGORY:=Network
TITLE:=DHCPv4/IPv4LL/IPv6RS/DHCPv6 quad stack client
URL:=http://roy.marples.name/projects/dhcpcd
endef
define Package/dhcpcd/description
DHCPv4, IPv6RS and DHCPv6 client with IPv4LL support
dhcpcd is a one stop network management daemon which includes
* RFC compliant DHCPv4 and DHCPv6 clients
* DHCPv6 Prefix Delegation support
* IPv4LL (aka ZeroConf) support
* ARP address conflict resolution
* Link carrier detection
* Wireless SSID profiles
* ARP ping profiles
endef
CONFIGURE_ARGS+= --prefix=/ --sbindir=/sbin \
--libexecdir=/lib/dhcpcd --dbdir=/var/dhcpcd
define Package/dhcpcd/install
$(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/dhcpcd/dhcpcd-hooks
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/dhcpcd $(1)/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/dhcpcd/dhcpcd-run-hooks \
$(1)/lib/dhcpcd/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/dhcpcd/dhcpcd-hooks/* \
$(1)/lib/dhcpcd/dhcpcd-hooks/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/dhcpcd.init $(1)/etc/init.d/dhcpcd
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/dhcpcd.conf $(1)/etc/dhcpcd.conf
endef
$(eval $(call BuildPackage,dhcpcd))

24
net/dhcpcd/files/dhcpcd.init Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh /etc/rc.common
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
START=30
STOP=85
USE_PROCD=1
start_service()
{
procd_open_instance
procd_set_param command /sbin/dhcpcd -B
procd_set_param respawn
procd_close_instance
}
reload_service()
{
/sbin/dhcpcd -n
}

45
net/horst/Makefile Normal file
View File

@ -0,0 +1,45 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=horst
PKG_VERSION:=4.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-git.tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=git://br1.einfach.org/horst
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=version-4.0
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/horst
SECTION:=net
CATEGORY:=Network
SUBMENU:=wireless
DEPENDS:=+libncurses
MAINTAINER:=Bruno Randolf <br1@einfach.org>
TITLE:=Highly Optimized 802.11 Radio Scanning Tool
URL:=http://br1.einfach.org/tech/horst/
endef
define Package/horst/description
[horst] is a scanning and analysis tool for 802.11 wireless networks
and especially IBSS (ad-hoc) mode and mesh networks (OLSR).
endef
define Package/horst/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/horst $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/horst.sh $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,horst))

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=nginx
PKG_VERSION:=1.4.7
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://nginx.org/download/

View File

@ -882,17 +882,6 @@ Index: nginx-1.4.7/src/http/ngx_http_request.c
#if (NGX_HTTP_SSL)
@@ -1291,6 +1368,10 @@ ngx_http_read_request_header(ngx_http_re
c = r->connection;
rev = c->read;
+fprintf(stderr, "DEBUG: pos: %p, last: %p, start: %p, end: %p\n",
+ r->header_in->pos, r->header_in->last, r->header_in->start,
+ r->header_in->end);
+
n = r->header_in->last - r->header_in->pos;
if (n > 0) {
Index: nginx-1.4.7/src/http/ngx_http_upstream.c
===================================================================
--- nginx-1.4.7.orig/src/http/ngx_http_upstream.c

View File

@ -4,30 +4,6 @@ SERVICE_USE_PID=1
START=50
setup_firewall() {
local port fw
config_get port $1 port
test -z "$port" && return
config_get fwport $1 fwport
test "$fwport" = "$port" && return
logger -t ocserv "opening port $port..."
#can we remove the old rule?
uci add firewall rule
uci set firewall.@rule[-1].src=wan
uci set firewall.@rule[-1].name="ocserv-ext-port"
uci set firewall.@rule[-1].target=ACCEPT
uci set firewall.@rule[-1].proto=tcpudp
uci set firewall.@rule[-1].dest_port=$port
uci commit firewall
uci set ocserv.config.fwport="$port"
uci commit ocserv
/etc/init.d/firewall restart
}
setup_config() {
config_get port $1 port "4443"
config_get max_clients $1 max_clients "8"
@ -170,8 +146,6 @@ start() {
chmod 600 /var/etc/ocpasswd
config_foreach setup_users ocservusers
setup_firewall config
service_start /usr/sbin/ocserv -c /var/etc/ocserv.conf
}

59
net/p910nd/Makefile Normal file
View File

@ -0,0 +1,59 @@
#
# Copyright (C) 2009-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=p910nd
PKG_VERSION:=0.97
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/p910nd
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=COPYING
PKG_MD5SUM:=69461a6c54dca0b13ecad5b83864b43e
PKG_MAINTAINER:=Philipp Kerling <pkerling@casix.org>
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/p910nd
SECTION:=net
CATEGORY:=Network
SUBMENU:=Printing
TITLE:=A small non-spooling printer server
URL:=http://p910nd.sourceforge.net
endef
define Package/p910nd/conffiles
/etc/config/p910nd
endef
define Package/p910nd/description
p910nd is a small daemon that copies any data received on
the port it is listening on to the corresponding printer
port. It is primarily intended for diskless Linux hosts
running as printer drivers but there is no reason why it
could not be used on diskful hosts. Port 9100 is copied
to /dev/lp0, 9101 to /dev/lp1 and 9102 to /dev/lp2. The
default is port 9100 to /dev/lp0.
endef
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS) -DLOCKFILE_DIR=\"\\\"/tmp\"\\\""
define Package/p910nd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/p910nd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/p910nd.config $(1)/etc/config/p910nd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/p910nd.init $(1)/etc/init.d/p910nd
endef
$(eval $(call BuildPackage,p910nd))

View File

@ -0,0 +1,5 @@
config p910nd
option device /dev/usb/lp0
option port 0
option bidirectional 1
option enabled 0

View File

@ -0,0 +1,51 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
START=50
append_bool() {
local section="$1"
local option="$2"
local value="$3"
local _val
config_get_bool _val "$section" "$option" '0'
[ "$_val" -gt 0 ] && append args "$3"
}
append_string() {
local section="$1"
local option="$2"
local value="$3"
local _val
config_get _val "$section" "$option"
[ -n "$_val" ] && append args "$3$_val"
}
start_service() {
local section="$1"
args=""
append_bool "$section" bidirectional "-b"
append_string "$section" device "-f "
append_string "$section" bind "-i "
append_string "$section" port ""
config_get_bool "enabled" "$section" "enabled" '1'
[ "$enabled" -gt 0 ] && /usr/sbin/p910nd $args
}
stop_service() {
local section="$1"
config_get port "$section" port
PID_F=/var/run/p910${port}d.pid
[ -f $PID_F ] && kill $(cat $PID_F)
}
start() {
config_load "p910nd"
config_foreach start_service p910nd
}
stop() {
config_load "p910nd"
config_foreach stop_service p910nd
}

57
net/radsecproxy/Makefile Normal file
View File

@ -0,0 +1,57 @@
#
# Copyright (C) 2008-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=radsecproxy
PKG_VERSION:=1.6.5
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://software.uninett.no/radsecproxy/
PKG_MD5SUM:=f74f82a7ae2cdf2b1d9d271a5c360617
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/radsecproxy
SECTION:=net
CATEGORY:=Network
DEPENDS:=+libopenssl +libpthread
TITLE:=radsecproxy
URL:=http://software.uninett.no/radsecproxy
MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
endef
define Package/radsecproxy/description
A generic radius proxy for UDP/TLS (RadSec)
endef
CONFIGURE_ARGS+= \
--with-ssl="$(STAGING_DIR)/usr"
#TARGET_CFLAGS += -ansi
#TARGET_CFLAGS += -std=c99
TARGET_CFLAGS += -Wno-long-long
define Package/radsecproxy/install
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radsecproxy $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/
$(CP) $(PKG_BUILD_DIR)/radsecproxy.conf-example $(1)/etc/radsecproxy.conf
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) ./files/radsecproxy.init $(1)/etc/init.d/radsecproxy
endef
define Package/radsecproxy/conffiles
/etc/radsecproxy.conf
endef
$(eval $(call BuildPackage,radsecproxy))

View File

@ -0,0 +1,16 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=70
USE_PROCD=1
PROG=/usr/sbin/radsecproxy
CONFFILE=/etc/radsecproxy.conf
start_service() {
procd_open_instance
procd_set_param command $PROG -f -c $CONFFILE
procd_set_param file $CONFFILE
procd_set_param respawn
procd_close_instance
}

View File

@ -0,0 +1,58 @@
--- a/dtls.c
+++ b/dtls.c
@@ -523,6 +523,7 @@ void *udpdtlsserverrd(void *arg) {
free(params);
cacheexpire(sessioncache, &lastexpiry);
}
+ return NULL;
}
int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *text) {
@@ -642,6 +643,7 @@ void *udpdtlsclientrd(void *arg) {
if (udp2bio(s, conf->servers->rbios, cnt))
debug(DBG_DBG, "radudpget: got DTLS in UDP from %s", addr2string((struct sockaddr *)&from));
}
+ return NULL;
}
void *dtlsclientrd(void *arg) {
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -3203,6 +3203,8 @@ void *sighandler(void *arg) {
debug(DBG_WARN, "sighandler: ignoring signal %d", sig);
}
}
+
+ return NULL;
}
int createpidfile(const char *pidfile) {
@@ -3289,6 +3291,8 @@ int radsecproxy_main(int argc, char **ar
/* just hang around doing nothing, anything to do here? */
for (;;)
sleep(1000);
+
+ return 0;
}
/* Local Variables: */
--- a/udp.c
+++ b/udp.c
@@ -266,6 +266,8 @@ void *udpclientrd(void *arg) {
buf = radudpget(*s, NULL, &server, NULL);
replyh(server, buf);
}
+
+ return NULL;
}
void *udpserverrd(void *arg) {
@@ -310,6 +312,8 @@ void *udpserverwr(void *arg) {
debug(DBG_DBG, "udpserverwr: refcount %d", reply->refcount);
freerq(reply);
}
+
+ return NULL;
}
void addclientudp(struct client *client) {

View File

@ -0,0 +1,31 @@
diff --git a/radsecproxy.c b/radsecproxy.c
index 563c4a8..9fa076d 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -3382,18 +3382,16 @@ int radsecproxy_main(int argc, char **argv) {
options.loglevel = loglevel;
else if (options.loglevel)
debug_set_level(options.loglevel);
- if (!foreground) {
- debug_set_destination(options.logdestination
- ? options.logdestination
- : "x-syslog:///", LOG_TYPE_DEBUG);
+ debug_set_destination(options.logdestination
+ ? options.logdestination
+ : "x-syslog:///", LOG_TYPE_DEBUG);
#if defined(WANT_FTICKS)
- if (options.ftickssyslogfacility) {
- debug_set_destination(options.ftickssyslogfacility,
- LOG_TYPE_FTICKS);
- free(options.ftickssyslogfacility);
- }
-#endif
+ if (options.ftickssyslogfacility) {
+ debug_set_destination(options.ftickssyslogfacility,
+ LOG_TYPE_FTICKS);
+ free(options.ftickssyslogfacility);
}
+#endif
free(options.logdestination);
if (!list_first(clconfs))

60
net/tinc/Makefile Normal file
View File

@ -0,0 +1,60 @@
#
# Copyright (C) 2007-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=tinc
PKG_VERSION:=1.0.24
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.tinc-vpn.org/packages
PKG_MD5SUM:=14a91eb2e85bdc0451a815612521b708
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/tinc
SECTION:=net
CATEGORY:=Network
DEPENDS:=+liblzo +libopenssl +kmod-tun
TITLE:=VPN tunneling daemon
URL:=http://www.tinc-vpn.org/
MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
SUBMENU:=VPN
endef
define Package/tinc/description
tinc is a Virtual Private Network (VPN) daemon that uses tunnelling and
encryption to create a secure private network between hosts on the Internet.
endef
TARGET_CFLAGS += -std=gnu99
CONFIGURE_ARGS += \
--with-kernel="$(LINUX_DIR)" \
--with-zlib="$(STAGING_DIR)/usr" \
--with-lzo-include="$(STAGING_DIR)/usr/include/lzo"
define Package/tinc/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tincd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
$(INSTALL_DIR) $(1)/etc/tinc
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DATA) files/tinc.upgrade $(1)/lib/upgrade/keep.d/tinc
endef
define Package/tinc/conffiles
/etc/config/tinc
endef
$(eval $(call BuildPackage,tinc))

View File

@ -0,0 +1,56 @@
config tinc-net NETNAME
option enabled 0
## Daemon Configuration (cmd arguments)
#option generate_keys 0
#option key_size 2048
#option logfile /tmp/log/tinc.NETNAME.log
#option debug 3
## Server Configuration (tinc.conf)
#option AddressFamily any
#option BindToAddress 127.0.0.1
#option BindToInterface lo
#list ConnectTo peer1
#option DirectOnly 0
#option Forwarding internal
#option GraphDumpFile /tmp/log/tinc.NETNAME.dot
#option Hostnames 0
#option IffOneQueue 0
#option Interface NETNAME
#option KeyExpire 3600
#option MACExpire 600
#option MaxTimeout 900
#option Mode router
option Name NODENAME
#option PingInterval 60
#option PingTimeout 5
#option PriorityInheritance 0
#option PrivateKeyFile /etc/tinc/NETNAME/rsa_key.priv
#option ProcessPriority normal
#option ReplayWindow 16
#option StrictSubnets 0
#option TunnelServer 0
#option UDPRcvBuf x
#option UDPSndBuf x
config tinc-host NODENAME
option enabled 0
option net NETNAME
#list Address example.com
#option Cipher blowfish
#option ClampMSS yes
#option Compression 0
#option Digest sha1
#option IndirectData 0
#option MACLength 4
#option PMTU 1514
#option PMTUDiscovery yes
#option Port 655
#option Subnet 192.168.1.0/24

241
net/tinc/files/tinc.init Normal file
View File

@ -0,0 +1,241 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2011 OpenWrt.org
# Copyright (C) 2011 Linus Lüssing
# Based on Jo-Philipp Wich's OpenVPN init script
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
START=42
SERVICE_USE_PID=1
BIN=/usr/sbin/tincd
EXTRA_COMMANDS="up down"
LIST_SEP="
"
TMP_TINC="/tmp/tinc"
append_param() {
local v="$1"
case "$v" in
*_*_*_*) v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;;
*_*_*) v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;;
*_*) v=${v%%_*}-${v#*_} ;;
esac
ARGS="$ARGS --$v"
return 0
}
append_conf_bools() {
local p; local v; local s="$1"; local f="$2"; shift; shift
for p in $*; do
config_get_bool v "$s" "$p"
[ "$v" == 1 ] && echo "$p = yes" >> "$f"
[ "$v" == 0 ] && echo "$p = no" >> "$f"
done
}
append_params() {
local p; local v; local s="$1"; shift
for p in $*; do
config_get v "$s" "$p"
IFS="$LIST_SEP"
for v in $v; do
[ -n "$v" ] && append_param "$p" && ARGS="$ARGS=$v"
done
unset IFS
done
}
append_conf_params() {
local p; local v; local s="$1"; local f="$2"; shift; shift
for p in $*; do
config_get v "$s" "$p"
IFS="$LIST_SEP"
for v in $v; do
# Look up OpenWRT interface names
[ "$p" = "BindToInterface" ] && {
local ifname=$(uci -P /var/state get network.$v.ifname 2>&-)
[ -n "$ifname" ] && v="$ifname"
}
[ -n "$v" ] && echo "$p = $v" >> "$f"
done
unset IFS
done
}
section_enabled() {
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
prepare_host() {
local s="$1"
local n
# net disabled?
config_get n "$s" net
section_enabled "$n" || return 1
if [ "$#" = "2" ]; then
[ "$2" != "$n" ] && return 1
fi
# host disabled?
section_enabled "$s" || {
[ -f "$TMP_TINC/$n/hosts/$s" ] && rm "$TMP_TINC/$n/hosts/$s"
return 1
}
[ ! -f "/etc/tinc/$n/hosts/$s" ] && {
echo -n "tinc: Warning, public key for $s for network $n "
echo -n "missing in /etc/tinc/$n/hosts/$s, "
echo "skipping configuration of $s"
return 1
}
# append flags
append_conf_bools "$s" "$TMP_TINC/$n/hosts/$s" \
ClampMSS IndirectData PMTUDiscovery TCPOnly
# append params
append_conf_params "$s" "$TMP_TINC/$n/hosts/$s" \
Address Cipher Compression Digest MACLength PMTU \
Port PublicKey PublicKeyFile Subnet
}
check_gen_own_key() {
local s="$1"; local n; local k
config_get n "$s" Name
config_get_bool k "$s" generate_keys 0
[ "$k" == 0 ] && return 0
([ -z "$n" ] || [ -f "$TMP_TINC/$s/hosts/$n" ] || [ -f "$TMP_TINC/$s/rsa_key.priv" ]) && \
return 0
[ ! -d "$TMP_TINC/$s/hosts" ] && mkdir -p "$TMP_TINC/$s/hosts"
config_get k "$s" key_size
if [ -z "$k" ]; then
$BIN -c "$TMP_TINC/$s" --generate-keys </dev/null
else
$BIN -c "$TMP_TINC/$s" "--generate-keys=$k" </dev/null
fi
[ ! -d "/etc/tinc/$s/hosts" ] && mkdir -p "/etc/tinc/$s/hosts"
cp "$TMP_TINC/$s/rsa_key.priv" "/etc/tinc/$s/"
[ -n "$n" ] && cp "$TMP_TINC/$s/hosts/$n" "/etc/tinc/$s/hosts/"
}
prepare_net() {
local s="$1"
local n
section_enabled "$s" || return 1
# rm old config
rm -rf "$TMP_TINC/$s/"
[ ! -d "$TMP_TINC/$s" ] && mkdir -p "$TMP_TINC/$s"
[ -d "/etc/tinc/$s" ] && cp -r "/etc/tinc/$s" "$TMP_TINC/"
# append flags
append_conf_bools "$s" "$TMP_TINC/$s/tinc.conf" \
DecrementTTL DirectOnly Hostnames IffOneQueue \
LocalDiscovery PriorityInheritance StrictSubnets TunnelServer \
ClampMSS IndirectData PMTUDiscovery TCPOnly
# append params
append_conf_params "$s" "$TMP_TINC/$s/tinc.conf" \
AddressFamily BindToAddress ConnectTo BindToInterface \
Broadcast Device DeviceType Forwarding \
GraphDumpFile Interface KeyExpire MACExpire \
MaxTimeout Mode Name PingInterval PingTimeout \
PrivateKey PrivateKeyFile ProcessPriority ReplayWindow \
UDPRcvBuf UDPSndBuf \
Address Cipher Compression Digest MACLength PMTU \
Port PublicKey PublicKeyFile Subnet
check_gen_own_key "$s" && return 0
}
start_instance() {
local s="$1"
section_enabled "$s" || return 1
ARGS=""
# append params
append_params "$s" logfile debug
SERVICE_PID_FILE="/var/run/tinc.$s.pid"
service_start $BIN -c "$TMP_TINC/$s" -n $s $ARGS --pidfile="$SERVICE_PID_FILE"
}
stop_instance() {
local s="$1"
section_enabled "$s" || return 1
SERVICE_PID_FILE="/var/run/tinc.$s.pid"
service_stop $BIN
# rm old config
rm -rf "$TMP_TINC/$s/"
}
reload_instance() {
local s="$1"
section_enabled "$s" || return 1
SERVICE_PID_FILE="/var/run/tinc.$s.pid"
service_reload $BIN
}
start() {
config_load 'tinc'
config_foreach prepare_net 'tinc-net'
config_foreach prepare_host 'tinc-host'
config_foreach start_instance 'tinc-net'
}
stop() {
config_load 'tinc'
config_foreach stop_instance 'tinc-net'
}
reload() {
config_load 'tinc'
config_foreach reload_instance 'tinc-net'
}
up() {
local exists
local instance
config_load 'tinc'
for instance in "$@"; do
config_get exists "$instance" 'TYPE'
if [ "$exists" == "tinc-net" ]; then
prepare_net "$instance"
config_foreach prepare_host 'tinc-host' "$instance"
start_instance "$instance"
fi
done
}
down() {
local exists
local instance
config_load 'tinc'
for instance in "$@"; do
config_get exists "$instance" 'TYPE'
if [ "$exists" == "tinc-net" ]; then
stop_instance "$instance"
fi
done
}

View File

@ -0,0 +1 @@
/etc/tinc/

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=mpd
PKG_VERSION:=0.18.11
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://www.musicpd.org/download/mpd/0.18/
@ -35,8 +35,8 @@ define Package/mpd/Default
CATEGORY:=Sound
TITLE:=Music Player Daemon
URL:=http://www.musicpd.org/
DEPENDS:= +glib2 +libcurl +libpthread +libmpdclient $(ICONV_DEPENDS) \
+libflac +BUILD_PATENTED:libmad +libvorbisidec
DEPENDS:= +glib2 +libcurl +libpthread +libmpdclient $(ICONV_DEPENDS) +libstdcpp \
+libflac +BUILD_PATENTED:libmad +libvorbisidec +AUDIO_SUPPORT:alsa-lib
endef
define Package/mpd/Default/description
@ -50,7 +50,6 @@ define Package/mpd-full
$(call Package/mpd/Default)
TITLE+= (full)
DEPENDS+= \
+AUDIO_SUPPORT:alsa-lib \
+libaudiofile +BUILD_PATENTED:libfaad2 +libffmpeg +libid3tag \
+libmms +libogg +libsndfile +libvorbis
PROVIDES:=mpd
@ -128,7 +127,7 @@ CONFIGURE_ARGS += \
--enable-flac \
--enable-httpd-output \
$(call autoconf_bool,CONFIG_BUILD_PATENTED,mad) \
$(call autoconf_bool,CONFIG_AUDIO_SUPPORT,oss) \
$(call autoconf_bool,CONFIG_AUDIO_SUPPORT,alsa) \
--enable-tcp \
--enable-un \

View File

@ -47,15 +47,6 @@ $(call Package/acl/Default)
CATEGORY:=Libraries
TITLE+=library
DEPENDS:=+libattr
KCONFIG:= \
CONFIG_EXT4_FS_POSIX_ACL=y \
CONFIG_FS_POSIX_ACL=y \
CONFIG_HFSPLUS_FS_POSIX_ACL=y \
CONFIG_JFFS2_FS_POSIX_ACL=y \
CONFIG_JFS_POSIX_ACL=y \
CONFIG_TMPFS_POSIX_ACL=y \
CONFIG_XFS_POSIX_ACL=y \
endef
define Package/libacl/description

View File

@ -46,14 +46,6 @@ $(call Package/attr/Default)
SECTION:=libs
CATEGORY:=Libraries
TITLE+=library
KCONFIG:= \
CONFIG_CIFS_XATTR=y \
CONFIG_EXT4_FS_XATTR=y \
CONFIG_JFFS2_FS_XATTR=y \
CONFIG_REISERFS_FS_XATTR=y \
CONFIG_SQUASHFS_XATTR=y \
CONFIG_TMPFS_XATTR=y \
endef
define Package/libattr/description