mirror of
https://github.com/xroche/httrack.git
synced 2026-07-07 09:26:35 +03:00
* htsencoding: bound the raw UTF-8 flush in hts_unescapeUrlSpecial The completed-sequence flush memcpy ends with a 'continue' that skips the per-byte NUL-reserve guard, so a raw multi-byte character landing at the exact end of dest let the trailing NUL write dest[max] (1-byte OOB, found by the post-#474 review pass; ASan-verified via the extended -#test=unescape-bounds). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> * Resurrect the java .class parser on modern Unix builds The plugin was dead three ways on a current Linux build: hts_plug() was compiled hidden (-fvisibility=hidden, EXTERNAL_FUNCTION expanded to nothing on ELF), hts_create_opt() dlopens libhtsjava.so.2 which no longer exists since the soname moved to .so.3, and JAVA_HEADER.magic is 'unsigned long' (8 bytes on LP64) under a 10-byte fread, so major/count came from uninitialized bytes and the 0xCAFEBABE check never matched. EXTERNAL_FUNCTION now forces default visibility on ELF, the dlopen name is derived from VERSION_INFO at configure time, and the header fields are fixed-width. 31_local-javaclass.test crawls a generated .class and asserts a resource named only in its constant pool is fetched; it fails if any of the three regresses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> * htsftp: assert nonzero buffer sizes, harden the userpass self-test ftp_split_userpass underflows its size-1 math on a zero size; assert the precondition now that the function is public in htsftp.h. The self-test gains a tight-size run with guard bytes and exact-content checks, which the 256-byte buffers alone could not fail on an off-by-one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> * configure: use the dylib plugin name on Darwin libtool names the module libhtsjava.N.dylib there, so the .so.N form can never load; caught by 31_local-javaclass.test on the macOS CI job (the old hardcoded .so.2 was just as dead, silently). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> * tests: cover the %xx-encoded UTF-8 flush path in unescape-bounds The raw-byte cases never take the utfBufferJ = lastJ rollback branch, so a wrong flush offset there would have passed (review finding). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> --------- Signed-off-by: Xavier Roche <roche@httrack.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
71 lines
2.2 KiB
C
71 lines
2.2 KiB
C
/* ------------------------------------------------------------ */
|
|
/*
|
|
HTTrack Website Copier, Offline Browser for Windows and Unix
|
|
Copyright (C) 1998 Xavier Roche and other contributors
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
Ethical use: we kindly ask that you NOT use this software to harvest email
|
|
addresses or to collect any other private information about people. Doing so
|
|
would dishonor our work and waste the many hours we have spent on it.
|
|
|
|
Please visit our Website: http://www.httrack.com
|
|
*/
|
|
|
|
/* ------------------------------------------------------------ */
|
|
/* File: Java classes parser .h */
|
|
/* Author: Yann Philippot */
|
|
/* ------------------------------------------------------------ */
|
|
|
|
#ifndef HTSJAVA_DEFH
|
|
#define HTSJAVA_DEFH
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifndef HTS_DEF_FWSTRUCT_JAVA_HEADER
|
|
#define HTS_DEF_FWSTRUCT_JAVA_HEADER
|
|
typedef struct JAVA_HEADER JAVA_HEADER;
|
|
#endif
|
|
/* 10-byte on-disk .class header image, fread() directly: fields need exact
|
|
widths (LP64's 8-byte 'unsigned long' magic never matched 0xCAFEBABE). */
|
|
struct JAVA_HEADER {
|
|
uint32_t magic;
|
|
uint16_t minor;
|
|
uint16_t major;
|
|
uint16_t count;
|
|
};
|
|
|
|
#ifndef HTS_DEF_FWSTRUCT_RESP_STRUCT
|
|
#define HTS_DEF_FWSTRUCT_RESP_STRUCT
|
|
typedef struct RESP_STRUCT RESP_STRUCT;
|
|
#endif
|
|
struct RESP_STRUCT {
|
|
int file_position;
|
|
//
|
|
unsigned int index1;
|
|
unsigned int type;
|
|
char name[1024];
|
|
};
|
|
|
|
/* Library internal definictions */
|
|
#ifdef HTS_INTERNAL_BYTECODE
|
|
|
|
EXTERNAL_FUNCTION int hts_plug_java(httrackp * opt, const char *argv);
|
|
|
|
#endif
|
|
|
|
#endif
|