Review comments

This commit is contained in:
Benedikt Reinartz 2021-05-18 07:20:58 +02:00
parent 5fb273fb60
commit ee5789ebc7
3 changed files with 27 additions and 6 deletions

View File

@ -19,13 +19,17 @@
#ifndef _mdbprivate_h_
#define _mdbprivate_h_
#include "mdbtools.h"
/*
* This header is for stuff lacking a MDB_ or mdb_ something, so they won't be
* exported to calling programs.
* This header is for stuff lacking a MDB_ or mdb_ something, or functions only
* used within mdbtools so they won't be exported to calling programs.
*/
#ifndef HAVE_G_MEMDUP2
#define g_memdup2 g_memdup
#endif
void mdb_rc4(unsigned char *key, guint32 key_len, unsigned char *buf, guint32 buf_len);
#endif

View File

@ -1,4 +1,22 @@
#include "mdbtools.h"
/* MDB Tools - A library for reading MS Access database files
* Copyright (C) 2000 Brian Bruns
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mdbprivate.h"
typedef struct _RC4_KEY
{

View File

@ -18,7 +18,7 @@
#include <time.h>
#include <inttypes.h>
#include "mdbtools.h"
#include "mdbprivate.h"
//static int mdb_copy_index_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg);
static int mdb_add_row_to_leaf_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg, MdbField *idx_fields, guint32 pgnum, guint16 rownum);
@ -82,8 +82,7 @@ mdb_write_pg(MdbHandle *mdb, unsigned long pg)
if (pg != 0 && mdb->f->db_key != 0)
{
buf = g_malloc(mdb->fmt->pg_size);
memcpy(buf, mdb->pg_buf, mdb->fmt->pg_size);
buf = g_memdup2(mdb->pg_buf, mdb->fmt->pg_size);
unsigned int tmp_key = mdb->f->db_key ^ pg;
mdb_rc4((unsigned char*)&tmp_key, 4, buf, mdb->fmt->pg_size);
}