Skip to content

Commit

Permalink
[FIX] addCmd segfault and LoRaSlot being unsigned
Browse files Browse the repository at this point in the history
 - assign newly allocated memory to cmdData before memcpy
 - LoRaSlot now int16_t
 - include stdint.h

ref #10
  • Loading branch information
xszymonzur committed Aug 27, 2023
1 parent 6e0ec5e commit deb2cec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions obc-firmware/interfaceview.ui.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<UI version="1.0" ><Entity id="{4c76f858-03de-4264-8ff7-1b3a466f1eb8}"><Taste RootCoordinates="-64100 -31300 141600 72600" coordinates="6000 7000 111400 47800">
<UI version="1.0" ><Entity id="{4c76f858-03de-4264-8ff7-1b3a466f1eb8}"><Taste coordinates="6000 7000 111400 47800" RootCoordinates="-64100 -31300 141600 72600">
</Taste>
</Entity><Entity id="{972e8e24-275f-4a0e-b469-39f22bf2547f}"><Taste RootCoordinates="-62600 -26600 62600 26600" coordinates="-50800 52600 131900 67400">
</Entity><Entity id="{972e8e24-275f-4a0e-b469-39f22bf2547f}"><Taste coordinates="-50800 52600 131900 67400" RootCoordinates="-62600 -26600 62600 26600">
</Taste>
</Entity><Entity id="{bb72fda3-b26b-440a-8320-300a1328ce27}"><Taste coordinates="-50800 55500">
</Taste>
Expand Down
7 changes: 4 additions & 3 deletions obc-firmware/work/hal/implem/msp430/C/src/hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>

#include "msp430_uart.h"

Expand Down Expand Up @@ -56,7 +57,7 @@ typedef struct commsDriverConfig {
uint16_t LoRaSpreading;
uint16_t LoRaLowOpt;
uint16_t LoRaCycle;
uint16_t LoRaSlot;
int16_t LoRaSlot;
char LoRaUplinkCode[LORA_UPLING_CODE_LENGTH+1];
char aprsCallsign[APRS_CALLSIGN_LENGTH+1];
} commsDriverConfig;
Expand Down Expand Up @@ -198,8 +199,8 @@ void cmdQueueAddCmd( cmdQueue* queue, const unsigned char cmd[], const unsigned
cmdQueueNode* newNode = (cmdQueueNode*)malloc(sizeof(cmdQueueNode));
if (newNode != NULL)
{
unsigned char* cmdDataField = (unsigned char*)malloc(sizeof(unsigned char*) * (paramSize+CMD_CODE_LENGTH));
if (cmdDataField == NULL) // not enought memory for newNode cmd data
newNode->cmdData = (unsigned char*)malloc(sizeof(unsigned char*) * (paramSize+CMD_CODE_LENGTH));
if (newNode->cmdData == NULL) // not enought memory for newNode cmd data
{
free(newNode);
}
Expand Down

0 comments on commit deb2cec

Please sign in to comment.