adafruit / adafruit/adafruit-beaglebone-io-python

Compilation Warnings when building CPP library

Open
#364 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
479
Forks
214
PR merge metrics
No merged PRs in 30d

Description

I am trying to make the library and I am getting the following warnings when compiling:

```
../../source/c_pwm.c: In function ‘pwm_setup’:
../../source/c_pwm.c:478:25: warning: ‘strncpy’ output may be truncated copying 250 bytes from a string of length 299 [-Wstringop-truncation]
strncpy(pwm_path, ecap_path_udev, sizeof(pwm_path));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

```
../../source/c_adc.c: In function ‘initialize_adc’:
../../source/c_adc.c:58:9: warning: ‘strncat’ specified bound 49 equals destination size [-Wstringop-overflow=]
strncat(adc_prefix_dir, "/sys/bus/iio/devices/iio:device0/in_voltage", sizeof(adc_prefix_dir));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

I am not sure how to fix this issue. Any help would be appreciated.

Contributor guide

No contributing guide indexed for this repository

Research direction

Review pwm_setup in source/c_pwm.c around line 478 and initialize_adc in source/c_adc.c around line 58, then reproduce the reported warnings with the library build. Check the existing path and ADC-prefix handling, and verify that the build completes without these warnings while preserving the intended paths.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.