arduino / arduino/Arduino

WIFI Shield support has some bad uses of strncpy()

Open
#6,564 0 comments 0 reactions 0 assignees View on GitHub
Architecture: AVR Component: Core Component: Firmware Library: Wifi Type: Bug
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

From code inspection:.. These are incorrect calls to strncpy - using the length of the source string rather than the destination buffer...

```
libraries/WiFi/extras/wifiHD/src/ard_spi.c - instances of:
strncpy(keyIdx, (const char*)¶ms->param, params->paramLen);

hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD/wl_api.h - instances of:
strncpy(net.ssid.ssid, "My AP", strlen("My AP"));
```

Contributor guide

Open the contributing guide

Research direction

Start with the listed strncpy instances in libraries/WiFi/extras/wifiHD/src/ard_spi.c and hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD/wl_api.h. Inspect the destination buffers and the surrounding WiFi Shield code; done means the identified calls use lengths appropriate for their destinations without introducing truncation or overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.