~ubuntu-branches/ubuntu/hardy/openswan/hardy-updates

« back to all changes in this revision

Viewing changes to linux/lib/libfreeswan/initaddr.c

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2005-01-27 16:10:11 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050127161011-idgybmyz3vwhpfiq
Tags: 2.3.0-2
Urgency HIGH due to security issue and problems with build-deps in sarge.
* Fix the security issue. Please see
  http://www.idefense.com/application/poi/display?id=190&
      type=vulnerabilities&flashstatus=false
  for more details. Thanks to Martin Schulze for informing me about
  this issue.
  Closes: #292458: Openswan XAUTH/PAM Buffer Overflow Vulnerability
* Added a Build-Dependency to lynx.
  Closes: #291143: openswan: FTBFS: Missing build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * initialize address structure
3
 
 * Copyright (C) 2000  Henry Spencer.
4
 
 * 
5
 
 * This library is free software; you can redistribute it and/or modify it
6
 
 * under the terms of the GNU Library General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or (at your
8
 
 * option) any later version.  See <http://www.fsf.org/copyleft/lgpl.txt>.
9
 
 * 
10
 
 * This library is distributed in the hope that it will be useful, but
11
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
13
 
 * License for more details.
14
 
 *
15
 
 * RCSID $Id: initaddr.c,v 1.3.36.1 2004/03/21 05:23:31 mcr Exp $
16
 
 */
17
 
#include "internal.h"
18
 
#include "openswan.h"
19
 
 
20
 
/*
21
 
 - initaddr - initialize ip_address from bytes
22
 
 */
23
 
err_t                           /* NULL for success, else string literal */
24
 
initaddr(src, srclen, af, dst)
25
 
const unsigned char *src;
26
 
size_t srclen;
27
 
int af;                         /* address family */
28
 
ip_address *dst;
29
 
{
30
 
        switch (af) {
31
 
        case AF_INET:
32
 
                if (srclen != 4)
33
 
                        return "IPv4 address must be exactly 4 bytes";
34
 
                dst->u.v4.sin_family = af;
35
 
                dst->u.v4.sin_port = 0;         /* unused */
36
 
                memcpy((char *)&dst->u.v4.sin_addr.s_addr, src, srclen);
37
 
                break;
38
 
        case AF_INET6:
39
 
                if (srclen != 16)
40
 
                        return "IPv6 address must be exactly 16 bytes";
41
 
                dst->u.v6.sin6_family = af;
42
 
                dst->u.v6.sin6_flowinfo = 0;            /* unused */
43
 
                dst->u.v6.sin6_port = 0;                /* unused */
44
 
                memcpy((char *)&dst->u.v6.sin6_addr, src, srclen);
45
 
                break;
46
 
        default:
47
 
                return "unknown address family in initaddr";
48
 
                break;
49
 
        }
50
 
        return NULL;
51
 
}