~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 1993 by Thomas Mueller
 
3
 *
 
4
 * Permission to use, copy, modify, distribute, and sell this software and its
 
5
 * documentation for any purpose is hereby granted without fee, provided that
 
6
 * the above copyright notice appear in all copies and that both that
 
7
 * copyright notice and this permission notice appear in supporting
 
8
 * documentation, and that the name of Thomas Mueller not be used in
 
9
 * advertising or publicity pertaining to distribution of the software without
 
10
 * specific, written prior permission.  Thomas Mueller makes no representations
 
11
 * about the suitability of this software for any purpose.  It is provided
 
12
 * "as is" without express or implied warranty.
 
13
 *
 
14
 * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
15
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
16
 * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
17
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
18
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
19
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
20
 * PERFORMANCE OF THIS SOFTWARE.
 
21
 *
 
22
 */
 
23
 
 
24
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c,v 3.6 2000/02/11 22:36:02 dawes Exp $ */
 
25
 
 
26
#include "X.h"
 
27
 
 
28
#include "xf86.h"
 
29
#include "xf86Priv.h"
 
30
#include "xf86_OSlib.h"
 
31
 
 
32
/*
 
33
 * Read BIOS using smem_create facility
 
34
 */
 
35
 
 
36
int
 
37
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
 
38
             int Len)
 
39
{
 
40
#if defined(__powerpc__)
 
41
        xf86Msg(X_WARNING, "xf86ReadBios: no BIOS-probe on PowerPC\n");
 
42
        return(-1);
 
43
#else
 
44
        char *p;
 
45
        int mlen;
 
46
 
 
47
        mlen = (Offset + Len + 4095) & ~4095;
 
48
        p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ);
 
49
        if (p == NULL)
 
50
        {
 
51
                /* check if there is a stale segment around */
 
52
                if (smem_remove("BIOS-probe") == 0) {
 
53
                    xf86Msg(X_INFO,
 
54
                        "xf86ReadBios: removed stale smem_ segment\n");
 
55
                    p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ);
 
56
                }
 
57
                if (p == NULL) {
 
58
                    xf86Msg(X_WARNING, "xf86ReadBios: Failed to smem_create "
 
59
                            "Base %x len %x %s \n",
 
60
                            Base, mlen, strerror(errno));
 
61
                    return(-1);
 
62
                }
 
63
        }
 
64
        memcpy(Buf, p + Offset, Len);
 
65
        smem_create(NULL, p, 0, SM_DETACH);
 
66
        smem_remove("BIOS-probe");
 
67
        return(Len);
 
68
#endif
 
69
}