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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/fb/fbgetsp.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
 * Id: fbgetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
 
3
 *
 
4
 * Copyright � 1998 Keith Packard
 
5
 *
 
6
 * Permission to use, copy, modify, distribute, and sell this software and its
 
7
 * documentation for any purpose is hereby granted without fee, provided that
 
8
 * the above copyright notice appear in all copies and that both that
 
9
 * copyright notice and this permission notice appear in supporting
 
10
 * documentation, and that the name of Keith Packard not be used in
 
11
 * advertising or publicity pertaining to distribution of the software without
 
12
 * specific, written prior permission.  Keith Packard makes no
 
13
 * representations about the suitability of this software for any purpose.  It
 
14
 * is provided "as is" without express or implied warranty.
 
15
 *
 
16
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
17
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
18
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
19
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
20
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
21
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
22
 * PERFORMANCE OF THIS SOFTWARE.
 
23
 */
 
24
/* $XFree86: xc/programs/Xserver/fb/fbgetsp.c,v 1.6 2001/05/29 04:54:09 keithp Exp $ */
 
25
 
 
26
#include "fb.h"
 
27
 
 
28
void
 
29
fbGetSpans(DrawablePtr  pDrawable, 
 
30
           int          wMax, 
 
31
           DDXPointPtr  ppt, 
 
32
           int          *pwidth, 
 
33
           int          nspans, 
 
34
           char         *pchardstStart)
 
35
{
 
36
    FbBits          *src, *dst;
 
37
    FbStride        srcStride;
 
38
    int             srcBpp;
 
39
    int             srcXoff, srcYoff;
 
40
    int             xoff;
 
41
    
 
42
    /*
 
43
     * XFree86 DDX empties the root borderClip when the VT is
 
44
     * switched away; this checks for that case
 
45
     */
 
46
    if (!fbDrawableEnabled(pDrawable))
 
47
        return;
 
48
    
 
49
#ifdef FB_24_32BIT
 
50
    if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
 
51
    {
 
52
        fb24_32GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
 
53
        return;
 
54
    }
 
55
#endif
 
56
    
 
57
    fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
 
58
    
 
59
    while (nspans--)
 
60
    {
 
61
        xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3));
 
62
        dst = (FbBits *) (pchardstStart - xoff);
 
63
        xoff <<= 3;
 
64
        fbBlt (src + (ppt->y + srcYoff) * srcStride, srcStride,
 
65
               (ppt->x + srcXoff) * srcBpp,
 
66
               
 
67
               dst,
 
68
               1,
 
69
               xoff,
 
70
 
 
71
               *pwidth * srcBpp,
 
72
               1,
 
73
 
 
74
               GXcopy,
 
75
               FB_ALLONES,
 
76
               srcBpp,
 
77
 
 
78
               FALSE,
 
79
               FALSE);
 
80
        pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
 
81
        ppt++;
 
82
        pwidth++;
 
83
    }
 
84
}