Skip to content

Commit

Permalink
Fix unchecked calloc bug in network.c
Browse files Browse the repository at this point in the history
At line 636 sport will always be non-NULL because it has already been checked in line 608 using early return on error.
Meanwhile result has never been checked against NULL and is subsequently used in line 696.
Probable cause of the bug is inadequate copy-and-pasting of code. I assume this changes it to the intended behavior.
  • Loading branch information
Robotic-Brain committed Jan 17, 2025
0 parents commit be670ec
Show file tree
Hide file tree
Showing 158 changed files with 57,405 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**

A clear and concise description of what the bug is.

**To Reproduce**

Steps to reproduce the behavior.

**Version**

What is the version of pgagroal ?

**PostgreSQL**

What is the version of PostgreSQL ?

**libev**

What is the version of libev ?

**OpenSSL**

What is the version of OpenSSL ?

**Access method**

Which security access method is used (trust, password, md5, scram-sha-256) ?

**OS**

Which Operating System (OS) is used ?

**ulimit**

What is the output from `ulimit -a` ?

**Configuration**

Can you provide the configuration pgagroal ?

* pgagroal.conf
* pgagroal_hba.conf
* pgagroal_databases.conf
* pgagroal_users.conf

**Debug logs**

Can you provide any debug logs (`log_level = debug5`) of the issue ?

**Tip**

Use \`\`\` before and after the text to keep the output as is.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Additional information**
Any additional information you can provide, like an overall design description
196 changes: 196 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-linux:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Add PostgreSQL apt repository
run: |
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo wget --quiet --output-document /etc/apt/trusted.gpg.d/apt.postgresql.org.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc
- name: Update system
run: sudo apt update
- name: Install libev
run: sudo apt install -y libev4 libev-dev
- name: Install systemd
run: sudo apt install -y libsystemd-dev
- name: Install rst2man
run: sudo apt install -y python3-docutils
- name: Install zstd
run: sudo apt install -y libzstd-dev
- name: Install lz4
run: sudo apt install -y liblz4-dev
- name: Install bzip2
run: sudo apt install -y libbz2-dev
- name: Install graphviz
run: sudo apt install graphviz
- name: Install doxygen
run: sudo apt install doxygen
- name: Install clang
run: sudo apt install -y clang
- name: Install PostgreSQL
run: sudo apt install -y postgresql
- name: Start postgres
run: |
version=$(pg_config --version | grep -Eo "[0-9]{1,2}" | head -1)
sudo -u postgres /usr/lib/postgresql/${version}/bin/pg_ctl start -D /etc/postgresql/${version}/main/
- name: GCC/mkdir
run: mkdir build
working-directory: /home/runner/work/pgagroal/pgagroal/
- name: GCC/cmake
run: sudo apt install cmake && export CC=/usr/bin/gcc && cmake -DCMAKE_BUILD_TYPE=Debug ..
working-directory: /home/runner/work/pgagroal/pgagroal/build/
- name: GCC/make
run: make
working-directory: /home/runner/work/pgagroal/pgagroal/build/
- name: GCC/Run pgagroal & confirm pgagroal is running
run: |
sudo mkdir -p /etc/pgagroal
sudo cp ../../doc/etc/*.conf /etc/pgagroal
./pgagroal >> /dev/null 2>&1 &
pid=$!
sleep 5
./pgagroal-cli ping
working-directory: /home/runner/work/pgagroal/pgagroal/build/src/
- name: GCC/Stop pgagroal & postgres
run: |
./pgagroal-cli shutdown
version=$(pg_config --version | grep -Eo "[0-9]{1,2}" | head -1)
sudo -u postgres /usr/lib/postgresql/${version}/bin/pg_ctl stop -D /etc/postgresql/${version}/main/
working-directory: /home/runner/work/pgagroal/pgagroal/build/src/
- name: rm -Rf
run: rm -Rf build/
working-directory: /home/runner/work/pgagroal/pgagroal/
- name: Start postgres
run: |
version=$(pg_config --version | grep -Eo "[0-9]{1,2}" | head -1)
sudo -u postgres /usr/lib/postgresql/${version}/bin/pg_ctl start -D /etc/postgresql/${version}/main/
- name: CLANG/mkdir
run: mkdir build
working-directory: /home/runner/work/pgagroal/pgagroal/
- name: CLANG/cmake
run: export CC=/usr/bin/clang && cmake -DCMAKE_BUILD_TYPE=Debug ..
working-directory: /home/runner/work/pgagroal/pgagroal/build/
- name: CLANG/make
run: make
working-directory: /home/runner/work/pgagroal/pgagroal/build/
- name: CLANG/Run pgagroal & confirm pgagroal is running
run: |
sudo mkdir -p /etc/pgagroal
sudo cp ../../doc/etc/*.conf /etc/pgagroal
./pgagroal >> /dev/null 2>&1 &
pid=$!
sleep 5
./pgagroal-cli ping
working-directory: /home/runner/work/pgagroal/pgagroal/build/src/
- name: CLANG/Stop pgagroal & postgres
run: |
./pgagroal-cli shutdown
version=$(pg_config --version | grep -Eo "[0-9]{1,2}" | head -1)
sudo -u postgres /usr/lib/postgresql/${version}/bin/pg_ctl stop -D /etc/postgresql/${version}/main/
working-directory: /home/runner/work/pgagroal/pgagroal/build/src/



build-macos:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Install Homebrew
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- name: Update system
run: brew update
- name: Install openssl
run: brew install openssl
- name: Install libev
run: brew install libev
- name: Install zstd
run: brew install zstd
- name: Install lz4
run: brew install lz4
- name: Install bzip2
run: brew install bzip2
- name: Install rst2man
run: brew install docutils
- name: Install graphviz
run: brew install graphviz
- name: Install doxygen
run: brew install doxygen
- name: Install clang
run: brew install llvm
- name: Install PostgreSQL
run: |
latest_pg=$(brew search postgresql | grep postgresql@ | tail -n 1)
brew install ${latest_pg} || true # `|| true` prevents install errors from breaking the run
- name: Start postgres
run: |
installed_pg=$(brew search postgresql | grep postgresql@ | tail -n 1)
brew services start ${installed_pg}
- name: GCC/mkdir
run: mkdir build
working-directory: /Users/runner/work/pgagroal/pgagroal/
- name: GCC/cmake
run: export CC=/usr/bin/gcc && export OPENSSL_ROOT_DIR=`brew --prefix openssl` && cmake -DCMAKE_BUILD_TYPE=Debug ..
working-directory: /Users/runner/work/pgagroal/pgagroal/build/
- name: GCC/make
run: make
working-directory: /Users/runner/work/pgagroal/pgagroal/build/
- name: GCC/Run pgagroal & confirm pgagroal is running
run: |
sudo mkdir -p /etc/pgagroal
sudo cp ../../doc/etc/*.conf /etc/pgagroal
./pgagroal >> /dev/null 2>&1 &
pid=$!
sleep 5
./pgagroal-cli ping
working-directory: /Users/runner/work/pgagroal/pgagroal/build/src/
- name: GCC/Stop pgagroal & postgres
run: |
./pgagroal-cli shutdown
installed_pg=$(brew search postgresql | grep postgresql@ | tail -n 1)
brew services stop ${installed_pg}
working-directory: /Users/runner/work/pgagroal/pgagroal/build/src/
- name: rm -Rf
run: rm -Rf build/
working-directory: /Users/runner/work/pgagroal/pgagroal/
- name: Start postgres
run: |
installed_pg=$(brew search postgresql | grep postgresql@ | tail -n 1)
brew services start ${installed_pg}
- name: CLANG/mkdir
run: mkdir build
working-directory: /Users/runner/work/pgagroal/pgagroal/
- name: CLANG/cmake
run: export CC=/usr/bin/clang && export OPENSSL_ROOT_DIR=`brew --prefix openssl` && cmake -DCMAKE_BUILD_TYPE=Debug ..
working-directory: /Users/runner/work/pgagroal/pgagroal/build/
- name: CLANG/make
run: make
working-directory: /Users/runner/work/pgagroal/pgagroal/build/
- name: CLANG/Run pgagroal & confirm pgagroal is running
run: |
sudo mkdir -p /etc/pgagroal
sudo cp ../../doc/etc/*.conf /etc/pgagroal
./pgagroal >> /dev/null 2>&1 &
pid=$!
sleep 5
./pgagroal-cli ping
working-directory: /Users/runner/work/pgagroal/pgagroal/build/src/
- name: CLANG/Stop pgagroal & postgres
run: |
./pgagroal-cli shutdown
installed_pg=$(brew search postgresql | grep postgresql@ | tail -n 1)
brew services stop ${installed_pg}
working-directory: /Users/runner/work/pgagroal/pgagroal/build/src/
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.bundle/
.cache/
_site/
build/
vendor/
17 changes: 17 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pgagroal was created by the following authors:

Jesper Pedersen <[email protected]>
David Fetter <[email protected]>
Will Leinweber <[email protected]>
Junduo Dong <[email protected]>
Luca Ferrari <[email protected]>
Nikita Bugrovsky <[email protected]>
Lawrence Wu <[email protected]>
Yongting You <[email protected]>
Ashutosh Sharma <[email protected]>
Henrique de Carvalho <[email protected]>
Yihe Lu <[email protected]>
Eugenio Gigante <[email protected]>
Haoran Zhang <[email protected]>
Mohanad Khaled <[email protected]>
Christian Englert <[email protected]>
Loading

0 comments on commit be670ec

Please sign in to comment.