~ubuntu-branches/ubuntu/oneiric/clamav/oneiric-updates

« back to all changes in this revision

Viewing changes to libclamav/iowrap.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Seth Arnold, Scott Kitterman
  • Date: 2013-04-25 23:41:55 UTC
  • mfrom: (114.1.2 oneiric-security)
  • Revision ID: package-import@ubuntu.com-20130425234155-5e19oj23w5sm7n4v
Tags: 0.97.8+dfsg-1ubuntu1.11.10.1
[ Seth Arnold ]
* SECURITY UPDATE: Updated to 0.97.8 to fix multiple security issues.
  - CVE-2013-2020 and CVE-2013-2021

[ Scott Kitterman ]
* Merge from Debian unstable (LP: #1172981).  Remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2012 Sourcefire, Inc.
 
3
 *
 
4
 *  Authors: Dave Raynor
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License version 2 as
 
8
 *  published by the Free Software Foundation.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
18
 *  MA 02110-1301, USA.
 
19
 *
 
20
 */
 
21
 
 
22
#include "iowrap.h"
 
23
 
 
24
#include <string.h>
 
25
 
 
26
#ifdef _WIN32
 
27
#include <windows.h>
 
28
#include <excpt.h>
 
29
 
 
30
#ifndef STATUS_DEVICE_DATA_ERROR
 
31
#define STATUS_DEVICE_DATA_ERROR 0xC000009C
 
32
#endif
 
33
#endif
 
34
 
 
35
#ifdef _WIN32
 
36
static int filter_memcpy(unsigned int code, struct _EXCEPTION_POINTERS *ep) {
 
37
    if ((code == EXCEPTION_IN_PAGE_ERROR) || (code == STATUS_DEVICE_DATA_ERROR)) {
 
38
        return EXCEPTION_EXECUTE_HANDLER;
 
39
    }
 
40
    return EXCEPTION_CONTINUE_SEARCH;
 
41
}
 
42
#endif
 
43
 
 
44
int cli_memcpy(void *target, const void *source, unsigned long size)
 
45
{
 
46
    int ret = 0;
 
47
 
 
48
#ifdef _WIN32
 
49
    __try {
 
50
#endif
 
51
    memcpy(target, source, size);
 
52
#ifdef _WIN32
 
53
    }
 
54
    __except (filter_memcpy(GetExceptionCode(), GetExceptionInformation())) {
 
55
        ret = 1;
 
56
    }
 
57
#endif
 
58
    return ret;
 
59
}
 
60