use strlcpy/strlcat

git-svn: trunk@476
remotes/push_mirror/metadata
Tomasz Kojm 22 years ago
parent ed026d3677
commit db1cae229c
  1. 1
      clamav-devel/AUTHORS
  2. 5
      clamav-devel/ChangeLog
  3. 4
      clamav-devel/aclocal.m4
  4. 6
      clamav-devel/clamav-config.h.in
  5. 2
      clamav-devel/clamav-milter/Makefile.am
  6. 25
      clamav-devel/clamav-milter/Makefile.in
  7. 12
      clamav-devel/clamav-milter/clamav-milter.c
  8. 2
      clamav-devel/clamd/Makefile.am
  9. 40
      clamav-devel/clamd/Makefile.in
  10. 5
      clamav-devel/clamd/dazukoio.c
  11. 7
      clamav-devel/clamd/dazukoio_compat12.c
  12. 3
      clamav-devel/clamd/localserver.c
  13. 5
      clamav-devel/clamd/options.c
  14. 2
      clamav-devel/clamdscan/Makefile.am
  15. 28
      clamav-devel/clamdscan/Makefile.in
  16. 3
      clamav-devel/clamdscan/client.c
  17. 2
      clamav-devel/clamscan/Makefile.am
  18. 29
      clamav-devel/clamscan/Makefile.in
  19. 5
      clamav-devel/clamscan/manager.c
  20. 5
      clamav-devel/clamscan/options.c
  21. 4
      clamav-devel/configure
  22. 2
      clamav-devel/configure.in
  23. 2
      clamav-devel/freshclam/Makefile.am
  24. 29
      clamav-devel/freshclam/Makefile.in
  25. 2
      clamav-devel/freshclam/notify.c
  26. 4
      clamav-devel/freshclam/options.c
  27. 2
      clamav-devel/libclamav/Makefile.am
  28. 2
      clamav-devel/libclamav/Makefile.in
  29. 7
      clamav-devel/libclamav/cvd.c
  30. 3
      clamav-devel/libclamav/others.c
  31. 3
      clamav-devel/libclamav/readdb.c
  32. 4
      clamav-devel/libclamav/str.c
  33. 5
      clamav-devel/libclamav/unrarlib.c
  34. 7
      clamav-devel/libclamav/zziplib/zzip-dir.c
  35. 3
      clamav-devel/shared/cfgparser.c
  36. 3
      clamav-devel/shared/output.c
  37. 55
      clamav-devel/shared/strutil.c
  38. 37
      clamav-devel/shared/strutil.h
  39. 2
      clamav-devel/sigtool/Makefile.am
  40. 26
      clamav-devel/sigtool/Makefile.in
  41. 5
      clamav-devel/sigtool/options.c
  42. 30
      clamav-devel/sigtool/sigtool.c

@ -76,6 +76,7 @@ James F. Hranicky <jfh*cise.ufl.edu>
Andy Igoshin <ai*vsu.ru>
Jesper Juhl <juhl*dif.dk>
Nicholas M. Kirsch <nick*kirsch.org>
Bastian Kleineidam <calvin*debian.org>
Robbert Kouprie <robbert*exx.nl>
Martin Kraft <martin.kraft*fal.de>
Thomas Lamy <Thomas.Lamy*in-online.net>

@ -1,3 +1,8 @@
Tue Apr 6 14:19:16 CEST 2004 (tk)
----------------------------------
* global hardening patch: use strlcpy/strlcat instead of strncpy/strncat
(Bastian Kleineidam <calvin*debian.org>)
Mon Apr 5 23:49:23 CEST 2004 (tk)
----------------------------------
* contrib: new init script for SuSE (by Martin Fuxa <yeti*email.cz>)

@ -81,7 +81,7 @@ dnl there is now a CREATE_PREFIX_TARGET_H in this file as a shorthand for
dnl PREFIX_CONFIG_H from a target.h file, however w/o the target.h ever created
dnl (the prefix is a bit different, since we add an extra -target- and -host-)
dnl
dnl @version: $Id: aclocal.m4,v 1.31 2004/04/05 21:42:10 kojm Exp $
dnl @version: $Id: aclocal.m4,v 1.32 2004/04/06 12:14:52 kojm Exp $
dnl @author Guido Draheim <guidod@gmx.de> STATUS: used often
AC_DEFUN([AC_CREATE_TARGET_H],
@ -4041,7 +4041,7 @@ dnl AC_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers)
dnl AC_COMPILE_CHECK_SIZEOF(off_t, $headers)
dnl
dnl @author Kaveh Ghazi <ghazi@caip.rutgers.edu>
dnl @version $Id: aclocal.m4,v 1.31 2004/04/05 21:42:10 kojm Exp $
dnl @version $Id: aclocal.m4,v 1.32 2004/04/06 12:14:52 kojm Exp $
dnl
AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
[changequote(<<, >>)dnl

@ -129,6 +129,12 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the <sys/inttypes.h> header file. */
#undef HAVE_SYS_INTTYPES_H

@ -28,6 +28,8 @@ clamav_milter_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
clamav-milter.c
man_MANS = $(top_srcdir)/docs/man/clamav-milter.8

@ -127,6 +127,8 @@ install_sh = @install_sh@
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ $(top_srcdir)/shared/getopt.h \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ $(top_srcdir)/shared/memory.c \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ $(top_srcdir)/shared/memory.h \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ $(top_srcdir)/shared/strutil.c \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ $(top_srcdir)/shared/strutil.h \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ clamav-milter.c
@ -152,6 +154,7 @@ PROGRAMS = $(sbin_PROGRAMS)
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ cfgparser.$(OBJEXT) \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ getopt.$(OBJEXT) \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ memory.$(OBJEXT) \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ strutil.$(OBJEXT) \
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@ clamav-milter.$(OBJEXT)
clamav_milter_OBJECTS = $(am_clamav_milter_OBJECTS)
clamav_milter_LDADD = $(LDADD)
@ -164,7 +167,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cfgparser.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/clamav-milter.Po ./$(DEPDIR)/getopt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/memory.Po
@AMDEP_TRUE@ ./$(DEPDIR)/memory.Po ./$(DEPDIR)/strutil.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@ -219,6 +222,7 @@ clean-sbinPROGRAMS:
cfgparser.$(OBJEXT): $(top_srcdir)/shared/cfgparser.c
getopt.$(OBJEXT): $(top_srcdir)/shared/getopt.c
memory.$(OBJEXT): $(top_srcdir)/shared/memory.c
strutil.$(OBJEXT): $(top_srcdir)/shared/strutil.c
clamav-milter$(EXEEXT): $(clamav_milter_OBJECTS) $(clamav_milter_DEPENDENCIES)
@rm -f clamav-milter$(EXEEXT)
$(LINK) $(clamav_milter_LDFLAGS) $(clamav_milter_OBJECTS) $(clamav_milter_LDADD) $(LIBS)
@ -233,6 +237,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clamav-milter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
@ -308,6 +313,24 @@ memory.lo: $(top_srcdir)/shared/memory.c
@AMDEP_TRUE@ depfile='$(DEPDIR)/memory.Plo' tmpdepfile='$(DEPDIR)/memory.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memory.lo `test -f '$(top_srcdir)/shared/memory.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/memory.c
strutil.o: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.o `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
strutil.obj: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.obj `cygpath -w $(top_srcdir)/shared/strutil.c`
strutil.lo: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Plo' tmpdepfile='$(DEPDIR)/strutil.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.lo `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:

@ -317,6 +317,9 @@
*
* Change History:
* $Log: clamav-milter.c,v $
* Revision 1.69 2004/04/06 12:14:52 kojm
* use strlcpy/strlcat
*
* Revision 1.68 2004/04/03 04:47:22 nigelhorne
* Honour StreamMaxLength
*
@ -506,7 +509,7 @@
* Revision 1.6 2003/09/28 16:37:23 nigelhorne
* Added -f flag use MaxThreads if --max-children not set
*/
static char const rcsid[] = "$Id: clamav-milter.c,v 1.68 2004/04/03 04:47:22 nigelhorne Exp $";
static char const rcsid[] = "$Id: clamav-milter.c,v 1.69 2004/04/06 12:14:52 kojm Exp $";
#define CM_VERSION "0.70g"
@ -522,6 +525,7 @@ static char const rcsid[] = "$Id: clamav-milter.c,v 1.68 2004/04/03 04:47:22 nig
#include "str.h"
#include "../libclamav/others.h"
#include "clamav.h"
#include "strutil.h"
#ifndef CL_DEBUG
#define NDEBUG
@ -1295,7 +1299,7 @@ pingServer(int serverNumber)
memset((char *)&server, 0, sizeof(struct sockaddr_un));
server.sun_family = AF_UNIX;
strncpy(server.sun_path, localSocket, sizeof(server.sun_path));
strlcpy(server.sun_path, localSocket, sizeof(server.sun_path));
if((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
perror("socket");
@ -1908,7 +1912,7 @@ clamfi_eom(SMFICTX *ctx)
memset((char *)&server, 0, sizeof(struct sockaddr_un));
server.sun_family = AF_UNIX;
strncpy(server.sun_path, localSocket, sizeof(server.sun_path));
strlcpy(server.sun_path, localSocket, sizeof(server.sun_path));
if((privdata->cmdSocket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
perror("socket");
@ -2579,7 +2583,7 @@ connect2clamd(struct privdata *privdata)
memset((char *)&server, 0, sizeof(struct sockaddr_un));
server.sun_family = AF_UNIX;
strncpy(server.sun_path, localSocket, sizeof(server.sun_path));
strlcpy(server.sun_path, localSocket, sizeof(server.sun_path));
if((privdata->cmdSocket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
perror("socket");

@ -28,6 +28,8 @@ clamd_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
options.c \
options.h \
clamd.c \

@ -127,6 +127,8 @@ install_sh = @install_sh@
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/getopt.h \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/memory.c \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/memory.h \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/strutil.c \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/strutil.h \
@BUILD_CLAMD_TRUE@ options.c \
@BUILD_CLAMD_TRUE@ options.h \
@BUILD_CLAMD_TRUE@ clamd.c \
@ -171,12 +173,13 @@ PROGRAMS = $(sbin_PROGRAMS)
@BUILD_CLAMD_TRUE@am_clamd_OBJECTS = output.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ cfgparser.$(OBJEXT) getopt.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ memory.$(OBJEXT) options.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ clamd.$(OBJEXT) tcpserver.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ localserver.$(OBJEXT) session.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ thrmgr.$(OBJEXT) server-th.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ scanner.$(OBJEXT) others.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ clamuko.$(OBJEXT) dazukoio_compat12.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ memory.$(OBJEXT) strutil.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ options.$(OBJEXT) clamd.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ tcpserver.$(OBJEXT) localserver.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ session.$(OBJEXT) thrmgr.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ server-th.$(OBJEXT) scanner.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ others.$(OBJEXT) clamuko.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ dazukoio_compat12.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ dazukoio.$(OBJEXT) tests.$(OBJEXT)
clamd_OBJECTS = $(am_clamd_OBJECTS)
clamd_LDADD = $(LDADD)
@ -194,8 +197,9 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/memory.Po ./$(DEPDIR)/options.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/others.Po ./$(DEPDIR)/output.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/scanner.Po ./$(DEPDIR)/server-th.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/session.Po ./$(DEPDIR)/tcpserver.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tests.Po ./$(DEPDIR)/thrmgr.Po
@AMDEP_TRUE@ ./$(DEPDIR)/session.Po ./$(DEPDIR)/strutil.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tcpserver.Po ./$(DEPDIR)/tests.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/thrmgr.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@ -248,6 +252,7 @@ output.$(OBJEXT): $(top_srcdir)/shared/output.c
cfgparser.$(OBJEXT): $(top_srcdir)/shared/cfgparser.c
getopt.$(OBJEXT): $(top_srcdir)/shared/getopt.c
memory.$(OBJEXT): $(top_srcdir)/shared/memory.c
strutil.$(OBJEXT): $(top_srcdir)/shared/strutil.c
clamd$(EXEEXT): $(clamd_OBJECTS) $(clamd_DEPENDENCIES)
@rm -f clamd$(EXEEXT)
$(LINK) $(clamd_LDFLAGS) $(clamd_OBJECTS) $(clamd_LDADD) $(LIBS)
@ -272,6 +277,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server-th.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/session.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpserver.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thrmgr.Po@am__quote@
@ -368,6 +374,24 @@ memory.lo: $(top_srcdir)/shared/memory.c
@AMDEP_TRUE@ depfile='$(DEPDIR)/memory.Plo' tmpdepfile='$(DEPDIR)/memory.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memory.lo `test -f '$(top_srcdir)/shared/memory.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/memory.c
strutil.o: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.o `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
strutil.obj: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.obj `cygpath -w $(top_srcdir)/shared/strutil.c`
strutil.lo: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Plo' tmpdepfile='$(DEPDIR)/strutil.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.lo `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:

@ -46,6 +46,7 @@
#include "dazukoio_xp.h"
#include "dazukoio.h"
#include "others.h"
#include "strutil.h"
#if !defined(NO_COMPAT12)
#include "dazukoio_compat12.h"
@ -173,12 +174,12 @@ int dazukoRegister_TS(dazuko_id_t **dazuko_id, const char *groupName, const char
if (strcasecmp(mode, "r") == 0)
{
strncpy(regMode, "R", sizeof(regMode));
strlcpy(regMode, "R", sizeof(regMode));
write_mode = 0;
}
else if (strcasecmp(mode, "r+") == 0 || strcasecmp(mode, "rw") == 0)
{
strncpy(regMode, "RW", sizeof(regMode));
strlcpy(regMode, "RW", sizeof(regMode));
write_mode = 1;
}
else

@ -47,6 +47,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include "dazukoio_compat12.h"
#include "strutil.h"
int dazukoRegister_TS_compat12_wrapper(struct dazuko_id **dazuko_id, const char *groupName)
{
@ -116,7 +117,7 @@ int dazukoRegister_TS_compat12(struct dazuko_id *dazuko, const char *groupName)
memset(opt, 0, sizeof(struct option_compat12));
opt->command = REGISTER;
strncpy(opt->buffer, groupName, sizeof(opt->buffer) - 1);
strlcpy(opt->buffer, groupName, sizeof(opt->buffer));
opt->buffer_length = strlen(opt->buffer) + 1;
if (ioctl(dazuko->device, _IOW(dazuko->dev_major, IOCTL_SET_OPTION, void *), opt) != 0)
@ -186,7 +187,7 @@ int dazuko_set_path_compat12(struct dazuko_id *dazuko, const char *path, int com
memset(opt, 0, sizeof(struct option_compat12));
opt->command = command;
strncpy(opt->buffer, path, sizeof(opt->buffer) - 1);
strlcpy(opt->buffer, path, sizeof(opt->buffer));
opt->buffer_length = strlen(opt->buffer) + 1;
if (ioctl(dazuko->device, _IOW(dazuko->dev_major, IOCTL_SET_OPTION, void *), opt) != 0)
@ -323,7 +324,7 @@ int dazukoReturnAccess_TS_compat12_wrapper(struct dazuko_id *dazuko, struct dazu
acc_compat12.pid = (*acc)->pid;
if ((*acc)->filename != NULL)
{
strncpy(acc_compat12.filename, (*acc)->filename, sizeof(acc_compat12.filename) - 1);
strlcpy(acc_compat12.filename, (*acc)->filename, sizeof(acc_compat12.filename));
acc_compat12.filename[sizeof(acc_compat12.filename) - 1] = 0;
}

@ -35,6 +35,7 @@
#include "others.h"
#include "server.h"
#include "output.h"
#include "strutil.h"
int localserver(const struct optstruct *opt, const struct cfgstruct *copt, struct cl_node *root)
{
@ -46,7 +47,7 @@ int localserver(const struct optstruct *opt, const struct cfgstruct *copt, struc
memset((char *) &server, 0, sizeof(server));
server.sun_family = AF_UNIX;
strncpy(server.sun_path, cfgopt(copt, "LocalSocket")->strarg, sizeof(server.sun_path));
strlcpy(server.sun_path, cfgopt(copt, "LocalSocket")->strarg, sizeof(server.sun_path));
if((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
estr = strerror(errno);

@ -37,6 +37,7 @@
#include "others.h"
#include "../libclamav/others.h"
#include "memory.h"
#include "strutil.h"
void clamd(struct optstruct *opt);
@ -104,9 +105,9 @@ int main(int argc, char **argv)
opt->filename=(char*)mcalloc(len + 256, sizeof(char));
for(i=optind; i<argc; i++) {
strncat(opt->filename, argv[i], strlen(argv[i]));
strlcat(opt->filename, argv[i], len+256);
if(i != argc-1)
strncat(opt->filename, " ", 1);
strlcat(opt->filename, " ", len+256);
}
}

@ -26,6 +26,8 @@ clamdscan_SOURCES = \
$(top_srcdir)/shared/cfgparser.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
clamdscan.c \
client.c \
client.h \

@ -125,6 +125,8 @@ install_sh = @install_sh@
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/cfgparser.h \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/memory.c \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/memory.h \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/strutil.c \
@BUILD_CLAMD_TRUE@ $(top_srcdir)/shared/strutil.h \
@BUILD_CLAMD_TRUE@ clamdscan.c \
@BUILD_CLAMD_TRUE@ client.c \
@BUILD_CLAMD_TRUE@ client.h \
@ -145,7 +147,8 @@ PROGRAMS = $(bin_PROGRAMS)
@BUILD_CLAMD_TRUE@am_clamdscan_OBJECTS = output.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ cfgparser.$(OBJEXT) memory.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ clamdscan.$(OBJEXT) client.$(OBJEXT)
@BUILD_CLAMD_TRUE@ strutil.$(OBJEXT) clamdscan.$(OBJEXT) \
@BUILD_CLAMD_TRUE@ client.$(OBJEXT)
clamdscan_OBJECTS = $(am_clamdscan_OBJECTS)
@BUILD_CLAMD_TRUE@clamdscan_DEPENDENCIES = \
@BUILD_CLAMD_TRUE@ $(top_builddir)/clamscan/options.o \
@ -161,7 +164,8 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cfgparser.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/clamdscan.Po ./$(DEPDIR)/client.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/memory.Po ./$(DEPDIR)/output.Po
@AMDEP_TRUE@ ./$(DEPDIR)/memory.Po ./$(DEPDIR)/output.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/strutil.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@ -213,6 +217,7 @@ clean-binPROGRAMS:
output.$(OBJEXT): $(top_srcdir)/shared/output.c
cfgparser.$(OBJEXT): $(top_srcdir)/shared/cfgparser.c
memory.$(OBJEXT): $(top_srcdir)/shared/memory.c
strutil.$(OBJEXT): $(top_srcdir)/shared/strutil.c
clamdscan$(EXEEXT): $(clamdscan_OBJECTS) $(clamdscan_DEPENDENCIES)
@rm -f clamdscan$(EXEEXT)
$(LINK) $(clamdscan_LDFLAGS) $(clamdscan_OBJECTS) $(clamdscan_LDADD) $(LIBS)
@ -228,6 +233,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
@ -303,6 +309,24 @@ memory.lo: $(top_srcdir)/shared/memory.c
@AMDEP_TRUE@ depfile='$(DEPDIR)/memory.Plo' tmpdepfile='$(DEPDIR)/memory.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memory.lo `test -f '$(top_srcdir)/shared/memory.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/memory.c
strutil.o: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.o `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
strutil.obj: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.obj `cygpath -w $(top_srcdir)/shared/strutil.c`
strutil.lo: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Plo' tmpdepfile='$(DEPDIR)/strutil.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.lo `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:

@ -38,6 +38,7 @@
#include "cfgparser.h"
#include "memory.h"
#include "output.h"
#include "strutil.h"
#ifdef PF_INET
# define SOCKET_INET PF_INET
@ -78,7 +79,7 @@ int client(const struct optstruct *opt)
} else if((cpt = cfgopt(copt, "LocalSocket"))) {
server.sun_family = AF_UNIX;
strncpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
strlcpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
if((sockd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
perror("socket()");

@ -25,6 +25,8 @@ clamscan_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
clamscan.c \
options.c \
options.h \

@ -126,6 +126,8 @@ clamscan_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
clamscan.c \
options.c \
options.h \
@ -150,8 +152,8 @@ bin_PROGRAMS = clamscan$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_clamscan_OBJECTS = output.$(OBJEXT) getopt.$(OBJEXT) memory.$(OBJEXT) \
clamscan.$(OBJEXT) options.$(OBJEXT) others.$(OBJEXT) \
manager.$(OBJEXT) treewalk.$(OBJEXT)
strutil.$(OBJEXT) clamscan.$(OBJEXT) options.$(OBJEXT) \
others.$(OBJEXT) manager.$(OBJEXT) treewalk.$(OBJEXT)
clamscan_OBJECTS = $(am_clamscan_OBJECTS)
clamscan_LDADD = $(LDADD)
clamscan_DEPENDENCIES =
@ -164,7 +166,8 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/clamscan.Po ./$(DEPDIR)/getopt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/manager.Po ./$(DEPDIR)/memory.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/options.Po ./$(DEPDIR)/others.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/output.Po ./$(DEPDIR)/treewalk.Po
@AMDEP_TRUE@ ./$(DEPDIR)/output.Po ./$(DEPDIR)/strutil.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/treewalk.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@ -216,6 +219,7 @@ clean-binPROGRAMS:
output.$(OBJEXT): $(top_srcdir)/shared/output.c
getopt.$(OBJEXT): $(top_srcdir)/shared/getopt.c
memory.$(OBJEXT): $(top_srcdir)/shared/memory.c
strutil.$(OBJEXT): $(top_srcdir)/shared/strutil.c
clamscan$(EXEEXT): $(clamscan_OBJECTS) $(clamscan_DEPENDENCIES)
@rm -f clamscan$(EXEEXT)
$(LINK) $(clamscan_LDFLAGS) $(clamscan_OBJECTS) $(clamscan_LDADD) $(LIBS)
@ -233,6 +237,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/others.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/treewalk.Po@am__quote@
distclean-depend:
@ -309,6 +314,24 @@ memory.lo: $(top_srcdir)/shared/memory.c
@AMDEP_TRUE@ depfile='$(DEPDIR)/memory.Plo' tmpdepfile='$(DEPDIR)/memory.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memory.lo `test -f '$(top_srcdir)/shared/memory.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/memory.c
strutil.o: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.o `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
strutil.obj: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.obj `cygpath -w $(top_srcdir)/shared/strutil.c`
strutil.lo: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Plo' tmpdepfile='$(DEPDIR)/strutil.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.lo `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:

@ -49,6 +49,7 @@
#include "strrcpy.h"
#include "memory.h"
#include "output.h"
#include "strutil.h"
#ifdef C_LINUX
dev_t procdev;
@ -133,7 +134,7 @@ int scanmanager(const struct optstruct *opt)
ptr = getargl(opt, "max-space");
if(tolower(ptr[strlen(ptr) - 1]) == 'm') {
cpy = mcalloc(strlen(ptr), sizeof(char));
strncpy(cpy, ptr, strlen(ptr) - 1);
strlcpy(cpy, ptr, strlen(ptr));
limits->maxfilesize = atoi(cpy) * 1024 * 1024;
free(cpy);
} else
@ -842,7 +843,7 @@ int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struc
ptr = getargl(opt, "max-space");
if(tolower(ptr[strlen(ptr) - 1]) == 'm') { /* megabytes */
cpy = mcalloc(strlen(ptr), sizeof(char));
strncpy(cpy, ptr, strlen(ptr) - 1);
strlcpy(cpy, ptr, strlen(ptr));
maxspace = atoi(cpy) * 1024;
free(cpy);
} else /* default - kilobytes */

@ -35,6 +35,7 @@
#include "shared.h"
#include "memory.h"
#include "output.h"
#include "strutil.h"
extern int clamscan(struct optstruct *opt);
@ -138,9 +139,9 @@ int main(int argc, char **argv)
opt->filename=(char*)mcalloc(len + 256, sizeof(char));
for(i=optind; i<argc; i++) {
strncat(opt->filename, argv[i], strlen(argv[i]));
strlcat(opt->filename, argv[i], len+256);
if(i != argc-1)
strncat(opt->filename, "\t", 1);
strlcat(opt->filename, "\t", len+256);
}
}

@ -8231,7 +8231,9 @@ _ACEOF
for ac_func in poll setsid memcpy snprintf vsnprintf strerror_r
for ac_func in poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5

@ -57,7 +57,7 @@ AC_TYPE_OFF_T
AC_COMPILE_CHECK_SIZEOF(short)
AC_COMPILE_CHECK_SIZEOF(int)
AC_COMPILE_CHECK_SIZEOF(long)
AC_CHECK_FUNCS(poll setsid memcpy snprintf vsnprintf strerror_r)
AC_CHECK_FUNCS(poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat)
# Check for broken snprintf
if test "x$ac_cv_func_snprintf" = "xyes" ; then

@ -27,6 +27,8 @@ freshclam_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
freshclam.c \
freshclam.h \
options.c \

@ -128,6 +128,8 @@ freshclam_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
freshclam.c \
freshclam.h \
options.c \
@ -150,8 +152,9 @@ bin_PROGRAMS = freshclam$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_freshclam_OBJECTS = output.$(OBJEXT) cfgparser.$(OBJEXT) \
getopt.$(OBJEXT) memory.$(OBJEXT) freshclam.$(OBJEXT) \
options.$(OBJEXT) manager.$(OBJEXT) notify.$(OBJEXT)
getopt.$(OBJEXT) memory.$(OBJEXT) strutil.$(OBJEXT) \
freshclam.$(OBJEXT) options.$(OBJEXT) manager.$(OBJEXT) \
notify.$(OBJEXT)
freshclam_OBJECTS = $(am_freshclam_OBJECTS)
freshclam_LDADD = $(LDADD)
freshclam_DEPENDENCIES =
@ -165,7 +168,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/freshclam.Po ./$(DEPDIR)/getopt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/manager.Po ./$(DEPDIR)/memory.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/notify.Po ./$(DEPDIR)/options.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/output.Po
@AMDEP_TRUE@ ./$(DEPDIR)/output.Po ./$(DEPDIR)/strutil.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@ -218,6 +221,7 @@ output.$(OBJEXT): $(top_srcdir)/shared/output.c
cfgparser.$(OBJEXT): $(top_srcdir)/shared/cfgparser.c
getopt.$(OBJEXT): $(top_srcdir)/shared/getopt.c
memory.$(OBJEXT): $(top_srcdir)/shared/memory.c
strutil.$(OBJEXT): $(top_srcdir)/shared/strutil.c
freshclam$(EXEEXT): $(freshclam_OBJECTS) $(freshclam_DEPENDENCIES)
@rm -f freshclam$(EXEEXT)
$(LINK) $(freshclam_LDFLAGS) $(freshclam_OBJECTS) $(freshclam_LDADD) $(LIBS)
@ -236,6 +240,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
@ -329,6 +334,24 @@ memory.lo: $(top_srcdir)/shared/memory.c
@AMDEP_TRUE@ depfile='$(DEPDIR)/memory.Plo' tmpdepfile='$(DEPDIR)/memory.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memory.lo `test -f '$(top_srcdir)/shared/memory.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/memory.c
strutil.o: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.o `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
strutil.obj: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.obj `cygpath -w $(top_srcdir)/shared/strutil.c`
strutil.lo: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Plo' tmpdepfile='$(DEPDIR)/strutil.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.lo `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:

@ -57,7 +57,7 @@ int notify(const char *cfgfile)
} else if((cpt = cfgopt(copt, "LocalSocket"))) {
socktype = "UNIX";
server.sun_family = AF_UNIX;
strncpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
strlcpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
if((sockd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
mprintf("@Clamd was NOT notified: Can't create socket endpoint for %s\n", cpt->strarg);

@ -107,9 +107,9 @@ int main(int argc, char **argv)
opt->filename=(char*)mcalloc(len + 256, sizeof(char));
for(i=optind; i<argc; i++) {
strncat(opt->filename, argv[i], strlen(argv[i]));
strlcat(opt->filename, argv[i], len+256);
if(i != argc-1)
strncat(opt->filename, " ", 1);
strlcat(opt->filename, " ", len+256);
}
}

@ -16,7 +16,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib -I$(top_srcdir)/shared
libclamav_la_LIBADD = @LIBCLAMAV_LIBS@

@ -116,7 +116,7 @@ am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib -I$(top_srcdir)/shared
libclamav_la_LIBADD = @LIBCLAMAV_LIBS@

@ -34,6 +34,7 @@
#include "others.h"
#include "dsig.h"
#include "str.h"
#include "strutil.h"
#define TAR_BLOCKSIZE 512
@ -74,8 +75,7 @@ int cli_untgz(int fd, const char *destdir)
if (block[0] == '\0') /* We're done */
break;
strncpy(name, block, 100);
name[100] = '\0';
strlcpy(name, block, 101);
strcpy(fullname, destdir);
strcat(fullname, "/");
strcat(fullname, name);
@ -117,8 +117,7 @@ int cli_untgz(int fd, const char *destdir)
return -1;
}
strncpy(osize, block + 124, 12);
osize[12] = '\0';
strlcpy(osize, block + 124, 13);
if((sscanf(osize, "%o", &size)) == 0) {
cli_errmsg("Invalid size in header.\n");

@ -47,6 +47,7 @@ pthread_mutex_t cl_gentemp_mutex = PTHREAD_MUTEX_INITIALIZER;
#include "clamav.h"
#include "others.h"
#include "md5.h"
#include "strutil.h"
#define CL_FLEVEL 1 /* don't touch it */
@ -299,7 +300,7 @@ char *cl_gentemp(const char *dir)
tmp = cl_md5buff(( char* ) salt, 48);
sprintf(name, "%s/", mdir);
strncat(name, tmp, 16);
strlcat(name, tmp, strlen(mdir) + 1 + 16 + 1);
free(tmp);
} while(stat(name, &foo) != -1);

@ -37,6 +37,7 @@
#include "others.h"
#include "str.h"
#include "defaults.h"
#include "strutil.h"
static int cli_parse_add(struct cl_node *root, const char *virname, const char *hexstr, int sigid, int parts, int partno)
{
@ -78,7 +79,7 @@ static int cli_parse_add(struct cl_node *root, const char *virname, const char *
return CL_EMEM;
}
strncpy(new->virname, virname, virlen);
strlcpy(new->virname, virname, virlen);
if((ret = cli_addpatt(root, new))) {
free(new->virname);

@ -30,6 +30,7 @@
#include "clamav.h"
#include "others.h"
#include "defaults.h"
#include "strutil.h"
static int cli_hex2int(int c)
{
@ -179,8 +180,7 @@ char *cli_strtok(const char *line, int fieldno, const char *delim)
return NULL;
}
buffer = malloc(j-i+1);
strncpy(buffer, line+i, j-i);
buffer[j-i] = '\0';
strlcpy(buffer, line+i, j-i+1);
return buffer;
}

@ -69,6 +69,7 @@
#include "unrarlib.h" /* include global configuration */
#include "others.h"
#include "strutil.h"
/* ------------------------------------------------------------------------ */
@ -1180,8 +1181,8 @@ int stricomp(char *Str1,char *Str2)
char S1[512],S2[512];
char *chptr;
strncpy(S1,Str1,sizeof(S1));
strncpy(S2,Str2,sizeof(S2));
strlcpy(S1,Str1,sizeof(S1));
strlcpy(S2,Str2,sizeof(S2));
while((chptr = strchr(S1, '\\')) != NULL) /* ignore backslash */
{

@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "strutil.h"
#ifdef ZZIP_HAVE_SYS_STAT_H
#include <sys/stat.h>
@ -83,9 +84,9 @@ real_readdir(ZZIP_DIR* dir)
if (! dirent) return 0;
dir->dirent.d_name = dirent->d_name;
strcpy(filename, dir->realname);
strcat(filename, "/");
strcat(filename, dirent->d_name);
strlcpy(filename, dir->realname, PATH_MAX);
strlcat(filename, "/", PATH_MAX);
strlcat(filename, dirent->d_name, PATH_MAX);
if (stat(filename, &st) == -1)
return -1;

@ -30,6 +30,7 @@
#include "defaults.h"
#include "str.h"
#include "memory.h"
#include "strutil.h"
static int isnumb(const char *str)
{
@ -176,7 +177,7 @@ struct cfgstruct *parsecfg(const char *cfgfile)
ctype = tolower(arg[strlen(arg) - 1]);
if(ctype == 'm' || ctype == 'k') {
char *cpy = (char *) mcalloc(strlen(arg), sizeof(char));
strncpy(cpy, arg, strlen(arg) - 1);
strlcpy(cpy, arg, strlen(arg));
if(!isnumb(cpy)) {
fprintf(stderr, "ERROR: Parse error at line %d: Option %s requires numerical (raw/K/M) argument.\n", line, name);
return NULL;

@ -42,6 +42,7 @@
#include "output.h"
#include "memory.h"
#include "strutil.h"
#ifdef CL_THREAD_SAFE
#include <pthread.h>
@ -136,7 +137,7 @@ int logg(const char *str, ...)
time(&currtime);
pt = ctime(&currtime);
timestr = mcalloc(strlen(pt), sizeof(char));
strncpy(timestr, pt, strlen(pt) - 1);
strlcpy(timestr, pt, strlen(pt));
fprintf(logg_fd, "%s -> ", timestr);
free(timestr);
}

@ -0,0 +1,55 @@
/*
* Copyright (C) 2004 Bastian Kleineidam <calvin@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
#include <string.h>
#include <stdlib.h>
#if !defined(HAVE_STRLCPY)
size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t ret = strlen(src);
if (size) {
size_t len = (ret >= size) ? size-1 : ret;
memcpy(dst, src, len);
dst[len] = '\0';
}
return ret;
}
#endif
#if !defined(HAVE_STRLCAT)
size_t strlcat(char *dst, const char *src, size_t size)
{
size_t dst_len = strlen(dst);
size_t src_len = strlen(src);
if (size) {
size_t len = (src_len >= size-dst_len) ? (size-dst_len-1) : src_len;
memcpy(&dst[dst_len], src, len);
dst[dst_len + len] = '\0';
}
return dst_len + src_len;
}
#endif

@ -0,0 +1,37 @@
/*
* Copyright (C) 2004 Bastian Kleineidam <calvin@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __STRUTIL_H
#define __STRUTIL_H
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
#include <string.h>
#include <stdlib.h>
#if !defined(HAVE_STRLCPY)
size_t strlcpy(char *dst, const char *src, size_t size);
#endif
#if !defined(HAVE_STRLCAT)
size_t strlcat(char *dst, const char *src, size_t size);
#endif
#endif

@ -24,6 +24,8 @@ sigtool_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
options.c \
options.h \
sigtool.c

@ -125,6 +125,8 @@ sigtool_SOURCES = \
$(top_srcdir)/shared/getopt.h \
$(top_srcdir)/shared/memory.c \
$(top_srcdir)/shared/memory.h \
$(top_srcdir)/shared/strutil.c \
$(top_srcdir)/shared/strutil.h \
options.c \
options.h \
sigtool.c
@ -143,7 +145,7 @@ bin_PROGRAMS = sigtool$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_sigtool_OBJECTS = output.$(OBJEXT) getopt.$(OBJEXT) memory.$(OBJEXT) \
options.$(OBJEXT) sigtool.$(OBJEXT)
strutil.$(OBJEXT) options.$(OBJEXT) sigtool.$(OBJEXT)
sigtool_OBJECTS = $(am_sigtool_OBJECTS)
sigtool_DEPENDENCIES = $(top_builddir)/clamscan/others.o
sigtool_LDFLAGS =
@ -154,7 +156,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/memory.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/options.Po ./$(DEPDIR)/output.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/sigtool.Po
@AMDEP_TRUE@ ./$(DEPDIR)/sigtool.Po ./$(DEPDIR)/strutil.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@ -206,6 +208,7 @@ clean-binPROGRAMS:
output.$(OBJEXT): $(top_srcdir)/shared/output.c
getopt.$(OBJEXT): $(top_srcdir)/shared/getopt.c
memory.$(OBJEXT): $(top_srcdir)/shared/memory.c
strutil.$(OBJEXT): $(top_srcdir)/shared/strutil.c
sigtool$(EXEEXT): $(sigtool_OBJECTS) $(sigtool_DEPENDENCIES)
@rm -f sigtool$(EXEEXT)
$(LINK) $(sigtool_LDFLAGS) $(sigtool_OBJECTS) $(sigtool_LDADD) $(LIBS)
@ -221,6 +224,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigtool.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
@ -296,6 +300,24 @@ memory.lo: $(top_srcdir)/shared/memory.c
@AMDEP_TRUE@ depfile='$(DEPDIR)/memory.Plo' tmpdepfile='$(DEPDIR)/memory.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memory.lo `test -f '$(top_srcdir)/shared/memory.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/memory.c
strutil.o: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.o `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
strutil.obj: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Po' tmpdepfile='$(DEPDIR)/strutil.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.obj `cygpath -w $(top_srcdir)/shared/strutil.c`
strutil.lo: $(top_srcdir)/shared/strutil.c
@AMDEP_TRUE@ source='$(top_srcdir)/shared/strutil.c' object='strutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/strutil.Plo' tmpdepfile='$(DEPDIR)/strutil.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strutil.lo `test -f '$(top_srcdir)/shared/strutil.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/strutil.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:

@ -33,6 +33,7 @@
#include "options.h"
#include "others.h"
#include "strutil.h"
void sigtool(struct optstruct *opt);
@ -113,9 +114,9 @@ int main(int argc, char **argv)
opt->filename=(char*)mcalloc(len + 256, sizeof(char));
for(i=optind; i<argc; i++) {
strncat(opt->filename, argv[i], strlen(argv[i]));
strlcat(opt->filename, argv[i], len+256);
if(i != argc-1)
strncat(opt->filename, " ", 1);
strlcat(opt->filename, " ", len+256);
}
} else

@ -47,6 +47,7 @@
#include "str.h"
#include "memory.h"
#include "output.h"
#include "strutil.h"
#define LINE 1024
@ -481,7 +482,7 @@ int build(struct optstruct *opt)
{
int ret, no = 0, realno = 0, bytes, itmp;
struct stat foo;
char buffer[FILEBUFF], *tarfile = NULL, *gzfile = NULL, header[257],
char buffer[FILEBUFF], *tarfile = NULL, *gzfile = NULL, header[513],
smbuff[30], *pt;
struct cl_node *root = NULL;
FILE *tar, *cvd, *fd;
@ -583,7 +584,7 @@ int build(struct optstruct *opt)
/* magic string */
strcpy(header, "ClamAV-VDB:");
strlcpy(header, "ClamAV-VDB:", sizeof(header));
/* time */
@ -591,7 +592,7 @@ int build(struct optstruct *opt)
brokent = localtime(&timet);
setlocale(LC_TIME, "C");
strftime(smbuff, 30, "%d %b %Y %H-%M %z", brokent);
strcat(header, smbuff);
strlcat(header, smbuff, sizeof(header));
/* version number */
@ -605,21 +606,21 @@ int build(struct optstruct *opt)
scanf("%d", &itmp);
sprintf(smbuff, "%d:", itmp);
}
strcat(header, smbuff);
strlcat(header, smbuff, sizeof(header));
/* number of signatures */
sprintf(smbuff, "%d:", no);
strcat(header, smbuff);
strlcat(header, smbuff, sizeof(header));
/* functionality level (TODO: use cl_funclevel()) */
sprintf(smbuff, "%d:", 1);
strcat(header, smbuff);
strlcat(header, smbuff, sizeof(header));
/* MD5 */
pt = cl_md5file(gzfile);
strcat(header, pt);
strlcat(header, pt, sizeof(header));
free(pt);
strcat(header, ":");
strlcat(header, ":", sizeof(header));
/* builder - question */
fflush(stdin);
@ -636,22 +637,17 @@ int build(struct optstruct *opt)
exit(1);
}
strcat(header, pt);
strlcat(header, pt, sizeof(header));
free(pt);
strcat(header, ":");
strlcat(header, ":", sizeof(header));
/* builder - add */
strcat(header, smbuff);
strlcat(header, smbuff, sizeof(header));
/* fill up with spaces */
if(strlen(header) > 512) {
mprintf("!Generated header is too long.\n");
unlink(gzfile);
exit(1);
}
while(strlen(header) < 512)
strcat(header, " ");
strlcat(header, " ", sizeof(header));
/* build the final database */

Loading…
Cancel
Save