adafruit / adafruit-beaglebone-io-python

Adafruit's BeagleBone IO Python Library
http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black
477 stars 217 forks source link

Compilation Warnings when building CPP library #364

Open bhvima opened 1 year ago

bhvima commented 1 year ago

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.