Skip to content

fix: add buffer-length check in sm_at_client.c #1375

fix: add buffer-length check in sm_at_client.c

fix: add buffer-length check in sm_at_client.c #1375

Workflow file for this run

name: Build
on:
workflow_dispatch:
pull_request:
paths-ignore:
- "doc/**"
- "README.md"
- ".github/workflows/*.yml"
- "!.github/workflows/build.yml"
schedule:
# Run every day at 03:00 AM
- cron: "00 3 * * *"
workflow_call:
inputs:
trigger_source:
description: 'Trigger source'
required: true
type: string
jobs:
build-and-test-in-toolchain-bundle:
runs-on: ubuntu-24.04
steps:
- name: Checkout Serial Modem repository
uses: actions/checkout@v4
with:
path: serial_modem
- name: Install build libraries for native_sim
run: |
sudo apt-get update
sudo apt install libc6-dev-i386
- name: Prepare west project
run: |
python3 -m pip install west
west init -l serial_modem
west update -o=--depth=1 -n
- name: Install nrfutil and toolchain manager
run: |
wget -q https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/executables/x86_64-unknown-linux-gnu/nrfutil
chmod +x nrfutil
./nrfutil install toolchain-manager
- name: Find proper toolchain bundle
id: set-tb-id
run: echo "TOOLCHAIN_BUNDLE_NAME=ncs-toolchain-x86_64-linux-$(./nrf/scripts/print_toolchain_checksum.sh).tar.gz" >> $GITHUB_OUTPUT
- name: Restore toolchain bundle from cache
id: restore-cached-tb
uses: actions/cache/restore@v4
with:
path: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
key: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
- name: Download toolchain bundle if not cached
if: steps.restore-cached-tb.outputs.cache-hit != 'true'
run: wget https://files.nordicsemi.com/artifactory/NCS/external/bundles/v3/${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
- name: Save toolchain bundle to cache
if: steps.restore-cached-tb.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
key: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
- name: Install proper toolchain bundle
run: ./nrfutil toolchain-manager install --toolchain-bundle ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
- name: Build Serial Modem for PR
if: github.event_name == 'pull_request'
run: |
./nrfutil toolchain-manager launch --chdir serial_modem -- west twister -T . -v --inline-logs --overflow-as-errors --integration --exclude-tag exclude_integration
- name: Build Serial Modem nightly
if: ${{ github.event_name == 'schedule' || inputs.trigger_source == 'release-workflow' || github.event_name == 'workflow_dispatch' }}
run: |
./nrfutil toolchain-manager launch --chdir serial_modem -- west twister -T . -v --inline-logs --overflow-as-errors --all
- name: Zip build artifacts
if: ${{ inputs.trigger_source == 'release-workflow' || github.event_name == 'workflow_dispatch' }}
working-directory: serial_modem
run: |
mkdir -p artifacts
mkdir -p artifacts_extras
VERSION=${{ github.event.release.tag_name || github.ref_name || 'unknown-version' }}
NRF9151DK_DIR=twister-out/nrf9151dk_nrf9151_ns/zephyr_gnu/serial_modem/app
NRF54L15DK_DIR=twister-out/nrf54l15dk_nrf54l15_cpuapp/zephyr_gnu/serial_modem/samples
# Create release bundle: merged.hex, Kconfig, signed images, elf, DFU zip
zip_artifacts() {
local app_build_dir="$1"
local src_dir="$2"
local base="$3"
local host="$4"
local temp root
root=$(pwd)
temp=$(mktemp -d)
cp "${src_dir}/merged.hex" "${temp}/${base}.hex"
cp "${src_dir}/${app_build_dir}/zephyr/.config" "${temp}/${base}.config"
cp "${src_dir}/${app_build_dir}/zephyr/zephyr.elf" "${temp}/${base}.elf"
cp "${src_dir}/${app_build_dir}/zephyr/zephyr.dts" "${temp}/${base}.dts"
if [ -z "$host" ]; then
cp "${src_dir}/${app_build_dir}/zephyr/zephyr.signed.bin" "${temp}/${base}.signed.bin"
cp "${src_dir}/dfu_application.zip" "${temp}/${base}_dfu_application.zip"
cp "${src_dir}/dfu_mcuboot.zip" "${temp}/${base}_dfu_mcuboot.zip"
cp "${src_dir}/signed_by_mcuboot_and_b0_mcuboot.bin" "${temp}/${base}_mcuboot_s0.signed.bin"
cp "${src_dir}/signed_by_mcuboot_and_b0_s1_image.bin" "${temp}/${base}_mcuboot_s1.signed.bin"
fi
(cd "$temp" && zip -q -r "$root/artifacts/${base}.zip" .)
cd ${src_dir}
find . -type f \( -name '*.elf' -o -name '*.dts' -o -name '.config' -o -name '*.bin' -o -name '*.hex' \) -exec zip -q -r "${root}/artifacts_extras/${base}_extras.zip" {} +
cd ${root}
rm -rf "$temp"
}
# nRF9151 DK builds for nRF91M1
zip_artifacts "app" "${NRF9151DK_DIR}/serial_modem.nrf91m1" "serial_modem_${VERSION}_nrf9151dk_nrf91m1"
# nRF9151 DK ext MCU builds
zip_artifacts "app" "${NRF9151DK_DIR}/serial_modem.ppp_cmux_with_extmcu" "serial_modem_${VERSION}_nrf9151dk_extmcu"
zip_artifacts "app" "${NRF9151DK_DIR}/serial_modem.ppp_cmux_with_extmcu.mtrace" "serial_modem_${VERSION}_nrf9151dk_extmcu_mtrace"
# nRF9151 DK normal builds (serial_modem.ppp_cmux)
zip_artifacts "app" "${NRF9151DK_DIR}/serial_modem.ppp_cmux" "serial_modem_${VERSION}_nrf9151dk_normal"
zip_artifacts "app" "${NRF9151DK_DIR}/serial_modem.ppp_cmux.mtrace" "serial_modem_${VERSION}_nrf9151dk_normal_mtrace"
# nRF54L15 DK AT client shell build
zip_artifacts "sm_at_client_shell" "${NRF54L15DK_DIR}/sm_at_client_shell/sample.sm_at_client_shell" "sm_at_client_shell_${VERSION}_nrf54l15dk" 1
# nRF54L15 DK PPP shell build
zip_artifacts "sm_ppp_shell" "${NRF54L15DK_DIR}/sm_ppp_shell/sample.sm_ppp_shell" "sm_ppp_shell_${VERSION}_nrf54l15dk" 1
- name: Upload artifacts
if: ${{ inputs.trigger_source == 'release-workflow' || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
path: |
serial_modem/artifacts/*
- name: Upload artifact extras
if: ${{ inputs.trigger_source == 'release-workflow' || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
name: artifact_extras
path: |
serial_modem/artifacts_extras/*