apache / apache/nuttx

[BUG] better to ban variable length arrays

Open
#15,572 2 comments 1 reaction 0 assignees View on GitHub
Arch: all OS: Mac Type: Bug
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 13h
Merged PRs (30d)
230

Description

### Description / Steps to reproduce the issue

it seems that we use variable length array (VLA) here and there.
eg. https://github.com/apache/nuttx/blob/118f8271038afe24732dfc4376fb63b72e039dba/net/usrsock/usrsock_sendmsg.c#L145

VLA is a C99 feature and should not be used in the common part of the OS. i guess it's better to add `-Wvla` there.

### On which OS does this issue occur?

[OS: Mac]

### What is the version of your OS?

macOS 15.2

### NuttX Version

master

### Issue Architecture

[Arch: all]

### Issue Area

[Area: Other]

### Verification

- [x] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Research direction

The example is net/usrsock/usrsock_sendmsg.c at the referenced line; start by inspecting that VLA use and the surrounding build configuration. Check how the common OS is compiled and enable -Wvla there to identify the remaining scope. Done means the common part builds without VLA warnings and the affected cases are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.