[riot-notifications] [RIOT-OS/RIOT] rn2xx3_cmd_append - Not terminating strings (#11499)

Alexander notifications at github.com
Wed May 8 11:22:48 CEST 2019

please submit it to the security mailing-list security at riot-os.org.

If your issue is a question related to the usage of RIOT, please submit it to
the user mailing-list users at riot-os.org or to the developer mailing-list
devel at riot-os.org.

#### Description
LoRa RN2XX3 driver function `rn2xx3_cmd_append` doesn't correctly terminate string.
Example: Cannot build gnrc_networking application for samr21-xpro board.

#### Steps to reproduce the issue
_Arduino Due + Mikroelektronika's RN2483 module_
When calling `rn2xx3_mac_set_nwkskey (&rn2xx3_dev, nwkskey)`, where `uint8_t nwkskey[16] = {0x78, ... , 0xBE}` the RN2483 module responds with an error. The problem is, when each byte of `nwkskey` is sent, the byte is converted to a string, which is incorrectly terminated and results in the sending of additional characters, ex: `78 `.
Substituting the following lines in `rn2xx3_cmd_append(rn2xx3_t *dev, const uint8_t *payload, uint8_t payload_len)` fixed the issue:
//char payload_str[2];
char payload_str[3] = {0};
Try to describe as precisely as possible here the steps required to reproduce
the issue. Here you can also describe your hardware configuration, the network
setup, etc.

#### Expected results
`[rn2xx3] RET: 0, RESP: ok`
Example: The gnrc_networking application builds on samr21-xpro.

#### Actual results
`[rn2xx3] RET: 0, RESP: alid_param`

#### Versions
Operating System Environment
       Operating System: "Ubuntu" "16.04.3 LTS (Xenial Xerus)"
                 Kernel: Linux 4.15.0-47-generic x86_64 x86_64

Installed compiler toolchains
             native gcc: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
      arm-none-eabi-gcc: arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)
                avr-gcc: avr-gcc (GCC) 4.9.2
       mips-mti-elf-gcc: missing
             msp430-gcc: missing
   riscv-none-embed-gcc: missing
   xtensa-esp32-elf-gcc: missing
   xtensa-lx106-elf-gcc: missing
                  clang: clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)

Installed compiler libs
   arm-none-eabi-newlib: "2.2.0"
    mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-lx106-elf-newlib: missing
               avr-libc: "1.8.0svn" ("20111229")

Installed development tools
                  cmake: missing
               cppcheck: missing
                doxygen: 1.8.11
                 flake8: missing
                    git: git version 2.7.4
                   make: GNU Make 4.1
                openocd: Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)
                 python: Python 2.7.12
                python2: Python 2.7.12
                python3: Python 3.5.2
             coccinelle: missing
Operating system: Mac OSX, Linux, Vagrant VM
Build environment: GCC, CLang versions (you can run the following command from
the RIOT base directory: ./dist/tools/ci/print_toolchain_versions.sh).

<!-- Thanks for contributing! -->

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190508/7a55110b/attachment.html>

More information about the notifications mailing list