Skip to content

Commit 792589d

Browse files
committed
run Coverity weekly
Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 72d31ed commit 792589d

File tree

3 files changed

+74
-6
lines changed

3 files changed

+74
-6
lines changed

.github/workflows/coverity.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Coverity
2+
3+
on:
4+
schedule:
5+
- cron: '0 18 * * SUN'
6+
workflow_dispatch:
7+
8+
#on:
9+
# push:
10+
# branches: [ master, coverity ]
11+
# pull_request:
12+
# types: [opened, synchronize, reopened]
13+
14+
jobs:
15+
build:
16+
name: Build and analyze
17+
runs-on: ubuntu-latest
18+
if: github.repository == 'OpenIDC/mod_auth_openidc'
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- name: Dependencies
24+
run: |
25+
sudo apt-get update -y
26+
sudo apt-get install -y apache2-dev libcjose-dev libssl-dev check pkg-config
27+
sudo apt-get install -y libjansson-dev libcurl4-openssl-dev libhiredis-dev libpcre2-dev
28+
- name: Download Coverity Build Tool
29+
env:
30+
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
31+
run: |
32+
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=OpenIDC%2Fmod_auth_openidc" -O cov-analysis-linux64.tar.gz
33+
mkdir cov-analysis-linux64
34+
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
35+
- name: Configure
36+
run: |
37+
./autogen.sh
38+
./configure
39+
- name: Make with cov-build
40+
run: |
41+
pwd
42+
export PATH=`pwd`/cov-analysis-linux64/bin:$PATH
43+
cov-build --dir cov-int make check
44+
- name: Submit to Coverity Scan
45+
env:
46+
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
47+
run: |
48+
tar czvf mod_auth_openidc.tgz cov-int
49+
curl \
50+
--form project=OpenIDC%2Fmod_auth_openidc \
51+
--form token=$TOKEN \
52+
53+
--form file=@mod_auth_openidc.tgz \
54+
--form version=master \
55+
--form description="`git rev-parse --abbrev-ref HEAD` `git rev-parse --short HEAD`" \
56+
https://scan.coverity.com/builds?project=OpenIDC%2Fmod_auth_openidc
57+
# - name: Coverity Scan
58+
# uses: blackduck-inc/[email protected]
59+
# with:
60+
# coverity_url: ${{ vars.COVERITY_URL }}
61+
# coverity_project_name: ${{ vars.COVERITY_PROJECT_NAME }}
62+
# coverity_user: ${{ vars.COVERITY_USER }}
63+
# coverity_passphrase: ${{ secrets.COVERITY_PASSPHRASE }}
64+
# coverity_build_command: make all
65+
# coverity_clean_command: make clean

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
12/15/2024
2+
- add Coverity Github action
3+
14
12/13/2024
25
- address warnings from static code analysis tool Coverity
36
- code: avoid potentional memory leak on cURL handle if curl_easy_escape/curl_easy_unescape fails

src/util.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -678,18 +678,18 @@ static const char *oidc_util_current_url_scheme(const request_rec *r, oidc_hdr_x
678678
static const char *oidc_util_port_from_host_hdr(const char *host_hdr) {
679679
const char *p = NULL;
680680

681-
if (host_hdr == NULL)
682-
return NULL;
683-
684681
// check for an IPv6 literal addresses
685-
if (host_hdr[0] == '[')
682+
if (host_hdr && host_hdr[0] == '[')
686683
p = strchr(host_hdr, ']');
687684
else
688685
p = host_hdr;
689686

690-
if ((p = strchr(p, OIDC_CHAR_COLON)))
687+
if (p) {
688+
p = strchr(p, OIDC_CHAR_COLON);
691689
// skip over the ":" to point to the actual port number
692-
p++;
690+
if (p)
691+
p++;
692+
}
693693

694694
return p;
695695
}

0 commit comments

Comments
 (0)