Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions source/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,8 @@ int lookup_uart_by_name(const char *input_name, char *dt)
uart_t *p;
for (p = uart_table; p->name != NULL; ++p) {
if (strcmp(p->name, input_name) == 0) {
strncpy(dt, p->dt, 8);
dt[8] = '\0';
fprintf(stderr, "return 1 lookup_uart_by_name");
strncpy(dt, p->dt, FILENAME_BUFFER_SIZE);
dt[FILENAME_BUFFER_SIZE - 1] = '\0';
return 1;
}
}
Expand Down
2 changes: 2 additions & 0 deletions source/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ SOFTWARE.

#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))

#define FILENAME_BUFFER_SIZE 128

int gpio_mode;
int gpio_direction[120];
int pwm_pins[120];
Expand Down
2 changes: 1 addition & 1 deletion source/py_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static PyObject *py_cleanup(PyObject *self, PyObject *args)
// python function setup()
static PyObject *py_setup_uart(PyObject *self, PyObject *args)
{
char dt[9];
char dt[FILENAME_BUFFER_SIZE];
char *channel;

if (!PyArg_ParseTuple(args, "s", &channel)) {
Expand Down