Commit Graph

11 Commits

Author SHA1 Message Date
Daniil Sarafannikov 5b90bc8285 roken:strsep_copy: Fix out-of-bounds write in strsep_copy
In case len < (size_t)(*stringp - save) and len > 0
access to buf[l] leads to out-of-bounds write as
l = len and len means the length of buffer.

Change evaluation of l: only len - 1 elements of
buffer can be used for memcpy and terminator
should be written to buf[len - 1] (in case l = len - 1).
Also, this value of l is not used when len == 0,
so we calculate it only when len > 0.

Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Daniil Sarafannikov <sarafannikovda@sgu.ru>
2026-06-30 10:19:03 +01:00
Love Hornquist Astrand f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Asanka Herath d00f9984a5 Make roken build on windows
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2009-11-24 21:42:02 -08:00
Love Hörnquist Åstrand 0d31d3d686 drop rcsid
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24356 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:30:37 +00:00
Love Hörnquist Åstrand 6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand 709aa58c74 define ROKEN_LIB_FUNCTION on all exported functions
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14773 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-04-12 11:29:18 +00:00
Johan Danielsson 3625b3f37b don't write to buf if len == 0
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11095 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-08-14 17:20:40 +00:00
Assar Westerlund 0481b7a38f replace MIN by min
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8480 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-06-29 03:13:36 +00:00
Johan Danielsson 224d353e1c strncpy -> memcpy
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8386 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-06-12 11:18:24 +00:00
Johan Danielsson 49e52ee4fe strsep, but with const stringp so returns string in separate buffer
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8383 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-06-12 11:16:07 +00:00