~ubuntu-branches/debian/sid/ircd-hybrid/sid

« back to all changes in this revision

Viewing changes to libltdl/lt__strl.c

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2015-04-19 15:53:09 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20150419155309-06y59x2at2ax5ou3
Tags: 1:8.2.7+dfsg.1-1
* Remove Suggests: hybserv since it doesn't really work with
  ircd-hybrid 8 and above
* New upstream release
  - update debian/copyright with minor changes
  - update config files from new reference.conf
  - fixes DoS from localhost clients (Closes: #782859)
  - supports SSL certficate chaining (Closes: #769741)
* Debconf configuration script no longer ignores the result of
  upgrade questions (Closes: #779082)
* Don't display upgrade warnings on new installs (Closes: #782883)
* Add NEWS item about updated configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* lt__strl.c -- size-bounded string copying and concatenation
2
2
 
3
 
   Copyright (C) 2004 Free Software Foundation, Inc.
 
3
   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
4
4
   Written by Bob Friesenhahn, 2004
5
5
 
6
6
   NOTE: The canonical source of this file is maintained with the
36
36
/*
37
37
 lt_strlcat appends the NULL-terminated string src to the end of dst.
38
38
 It will append at most dstsize - strlen(dst) - 1 bytes,
39
 
 NULL-terminating the result. The total length of the string which
 
39
 NULL-terminating the result. The total length of the string that
40
40
 would have been created given sufficient buffer size (may be longer
41
 
 than dstsize) is returned.  This function substitutes for strlcat()
 
41
 than dstsize) is returned.  This function substitutes for strlcat(),
42
42
 which is available under NetBSD, FreeBSD and Solaris 9.
43
43
 
44
44
 Buffer overflow can be checked as follows:
46
46
   if (lt_strlcat(dst, src, dstsize) >= dstsize)
47
47
     return -1;
48
48
*/
49
 
#if !defined(HAVE_STRLCAT)
 
49
#if !defined HAVE_STRLCAT
50
50
size_t
51
51
lt_strlcat(char *dst, const char *src, const size_t dstsize)
52
52
{
65
65
    size - 1.
66
66
  */
67
67
  for ( p = dst + length, q = src;
68
 
        (*q != 0) && (length < dstsize - 1) ;
 
68
        (*q != 0) && (length < dstsize - 1);
69
69
        length++, p++, q++ )
70
70
    *p = *q;
71
71
 
79
79
 
80
80
  return length;
81
81
}
82
 
#endif /* !defined(HAVE_STRLCAT) */
 
82
#endif /* !defined HAVE_STRLCAT */
83
83
 
84
84
/*
85
85
  lt_strlcpy copies up to dstsize - 1 characters from the NULL-terminated
86
86
  string src to dst, NULL-terminating the result. The total length of
87
 
  the string which would have been created given sufficient buffer
 
87
  the string that would have been created given sufficient buffer
88
88
  size (may be longer than dstsize) is returned. This function
89
 
  substitutes for strlcpy() which is available under OpenBSD, FreeBSD
 
89
  substitutes for strlcpy(), which is available under OpenBSD, FreeBSD
90
90
  and Solaris 9.
91
91
 
92
92
  Buffer overflow can be checked as  follows:
94
94
    if (lt_strlcpy(dst, src, dstsize) >= dstsize)
95
95
      return -1;
96
96
*/
97
 
#if !defined(HAVE_STRLCPY)
 
97
#if !defined HAVE_STRLCPY
98
98
size_t
99
99
lt_strlcpy(char *dst, const char *src, const size_t dstsize)
100
100
{
109
109
  /*
110
110
    Copy src to dst within bounds of size-1.
111
111
  */
112
 
  for ( p=dst, q=src, length=0 ;
113
 
        (*q != 0) && (length < dstsize-1) ;
 
112
  for ( p=dst, q=src, length=0;
 
113
        (*q != 0) && (length < dstsize-1);
114
114
        length++, p++, q++ )
115
115
    *p = *q;
116
116
 
124
124
 
125
125
  return length;
126
126
}
127
 
#endif /* !defined(HAVE_STRLCPY) */
 
127
#endif /* !defined HAVE_STRLCPY */