[Mplayer-cvslog] CVS: main/osdep strl.c, NONE, 1.1 Makefile, 1.14, 1.15
Diego Biurrun CVS
syncmail at mplayerhq.hu
Fri Jun 25 18:49:54 CEST 2004
CVS change done by Diego Biurrun CVS
Update of /cvsroot/mplayer/main/osdep
In directory mail:/var2/tmp/cvs-serv17907/osdep
Modified Files:
Makefile
Added Files:
strl.c
Log Message:
string handling security fixes
patch by Nicholas Kain, Alexander Strasser <eclipse7 at gmx.net>
reviewed by Pontscho, Alex, Rich
--- NEW FILE ---
/* strl(cat|cpy) implementation for systems that do not have it in libc */
/* strl.c - strlcpy/strlcat implementation
* Time-stamp: <2004-03-14 njk>
* (C) 2003-2004 Nicholas J. Kain <njk at aerifal.cx>
*/
#include "../config.h"
#ifndef HAVE_STRLCPY
unsigned int strlcpy (char *dest, char *src, unsigned int size)
{
register unsigned int i;
for (i=0; size > 0 && src[i] != '\0'; ++i, size--)
dest[i] = src[i];
dest[i] = '\0';
return i;
}
#endif
#ifndef HAVE_STRLCAT
unsigned int strlcat (char *dest, char *src, unsigned int size)
{
#if 0
register unsigned int i, j;
for(i=0; size > 0 && dest[i] != '\0'; size--, i++);
for(j=0; size > 0 && src[j] != '\0'; size--, i++, j++)
dest[i] = src[j];
dest[i] = '\0';
return i;
#else
register char *d = dest, *s = src;
for (; size > 0 && *d != '\0'; size--, d++);
for (; size > 0 && *s != '\0'; size--, d++, s++)
*d = *s;
*d = '\0';
return (d - dest) + (s - src);
#endif
}
#endif
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/Makefile,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Makefile 24 Jun 2004 12:52:17 -0000 1.14
+++ Makefile 25 Jun 2004 16:49:52 -0000 1.15
@@ -3,7 +3,8 @@
LIBNAME = libosdep.a
-SRCS= shmem.c strsep.c vsscanf.c scandir.c gettimeofday.c fseeko.c # timer.c
+SRCS= shmem.c strsep.c strl.c vsscanf.c scandir.c gettimeofday.c fseeko.c \
+ # timer.c
ifeq ($(TARGET_ARCH_X86),yes)
ifeq ($(TARGET_OS),Linux)
More information about the MPlayer-cvslog
mailing list