9 Commits

Author SHA1 Message Date
Xavier Roche
b21f85c53f Merge pull request #317 from xroche/fix/cookie-cmp-loop
Fix never-matching wildcard cookie domain comparison
2026-06-09 20:12:01 +02:00
Xavier Roche
0a20aa8522 Fix never-matching wildcard cookie domain comparison
cookie_cmp_wildcard_domain used an unsigned loop counter, so i >= 0 was always
true (infinite loop and out-of-bounds reads) and an empty domain underflowed
l - 1. Use a signed counter. Found and fixed by greenrd in #172. closes #171
2026-06-09 20:09:23 +02:00
Xavier Roche
abd19b8cfa Merge pull request #316 from xroche/chore/changelog-news-symlink
build: symlink ChangeLog and NEWS to history.txt
2026-06-08 20:40:51 +02:00
Xavier Roche
4797749d4d build: symlink ChangeLog and NEWS to history.txt
They were empty automake stubs (GNU strictness requires the files to exist).
Pointing them at history.txt satisfies automake, drops the confusing empty
files, and ships a real changelog in the dist tarball without duplicating
content in git.
2026-06-08 20:40:27 +02:00
Xavier Roche
566b9d5008 Merge pull request #315 from xroche/docs/readme-badges
docs: add CI and license badges to README.md
2026-06-08 20:22:21 +02:00
Xavier Roche
8b6bc1d0ed docs: add CI and license badges to README.md 2026-06-08 20:21:52 +02:00
Xavier Roche
e4fc8ca26f Merge pull request #314 from xroche/ci/github-actions
ci: add GitHub Actions build/test matrix and shell lint
2026-06-08 20:19:11 +02:00
Xavier Roche
52692668cd ci: add GitHub Actions build/test matrix and shell lint
Build and test (autoreconf, configure, make, make check) on x86-64 and arm64
with gcc and clang. A lint job runs shellcheck and shfmt -i 4 on the maintained
scripts.
2026-06-08 20:16:38 +02:00
Xavier Roche
a2b3dc93a3 Merge pull request #313 from xroche/feat/license-gpl3-simplify
Drop the OpenSSL linking exception, simplify to GPL-3.0
2026-06-07 14:38:17 +02:00
5 changed files with 94 additions and 2 deletions

87
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,87 @@
# Build and test on x86-64 and arm64, and lint the shell scripts.
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
# Least privilege: the workflow only needs to read the repo.
permissions:
contents: read
# Cancel superseded runs on the same branch or PR.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: build (${{ matrix.arch }}, ${{ matrix.cc }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- { arch: x86-64, runner: ubuntu-24.04, cc: gcc }
- { arch: x86-64, runner: ubuntu-24.04, cc: clang }
- { arch: arm64, runner: ubuntu-24.04-arm, cc: gcc }
- { arch: arm64, runner: ubuntu-24.04-arm, cc: clang }
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install build dependencies
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential clang autoconf automake libtool autoconf-archive \
zlib1g-dev libssl-dev
- name: Configure
run: |
set -euo pipefail
# autoreconf installs the automake test-driver (not committed) and
# validates configure.ac, so "make check" works on a fresh checkout.
autoreconf -fi
./configure
- name: Build
run: make -j"$(nproc)"
- name: Test
run: make check
- name: Print the test log on failure
if: failure()
run: cat tests/test-suite.log 2>/dev/null || true
lint:
name: lint (shellcheck, shfmt)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install linters
env:
SHFMT_VERSION: v3.8.0
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends shellcheck
# shfmt is not packaged in apt; fetch a pinned release binary.
curl -fsSL -o /tmp/shfmt \
"https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_$(dpkg --print-architecture)"
sudo install -m 0755 /tmp/shfmt /usr/local/bin/shfmt
# Lint the scripts we maintain; the legacy scripts are a separate cleanup.
- name: shellcheck
run: shellcheck man/makeman.sh tools/mkdeb.sh tests/*.test tests/check-network.sh
- name: shfmt
run: shfmt -d -i 4 man/makeman.sh tools/mkdeb.sh

View File

1
ChangeLog Symbolic link
View File

@@ -0,0 +1 @@
history.txt

0
NEWS
View File

1
NEWS Symbolic link
View File

@@ -0,0 +1 @@
history.txt

View File

@@ -1,5 +1,8 @@
# HTTrack Website Copier - Development Repository
[![CI](https://github.com/xroche/httrack/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/xroche/httrack/actions/workflows/ci.yml)
[![License](https://img.shields.io/github/license/xroche/httrack)](COPYING)
## About
_Copy websites to your computer (Offline browser)_

View File

@@ -133,8 +133,8 @@ static int cookie_cmp_wildcard_domain(const char *chk_dom, const char *domain) {
const size_t n = strlen(chk_dom);
const size_t m = strlen(domain);
const size_t l = n < m ? n : m;
size_t i;
for (i = l - 1; i >= 0; i--) {
int i;
for (i = (int) l - 1; i >= 0; i--) {
if (chk_dom[n - i - 1] != domain[m - i - 1]) {
return 1;
}