use MAXPDSTRING for size of serial_device_prefix

This commit is contained in:
IOhannes m zmölnig 2022-03-21 10:57:58 +01:00
parent 7cfa0d75c6
commit e093e5c1f7

View file

@ -77,7 +77,7 @@ typedef struct comport
/* device specifications */
t_symbol *serial_device;
char serial_device_prefix[FILENAME_MAX];/* the device name without the number */
char serial_device_prefix[MAXPDSTRING];/* the device name without the number */
short comport; /* holds the comport # */
/* device configuration */
@ -1361,7 +1361,7 @@ allows COM port numbers to be specified. */
#ifdef _WIN32
strncpy_s(test.serial_device_prefix, strlen(serial_device_prefix) + 1, serial_device_prefix, strlen(serial_device_prefix) + 1);
#else
strncpy(test.serial_device_prefix, serial_device_prefix, strlen(serial_device_prefix) + 1);
strncpy(test.serial_device_prefix, serial_device_prefix, MAXPDSTRING);
#endif
test.baud = ibaud;
test.data_bits = 8; /* default 8 data bits */
@ -1383,7 +1383,7 @@ allows COM port numbers to be specified. */
#ifdef _WIN32
strncpy_s(x->serial_device_prefix, strlen(serial_device_prefix) + 1, serial_device_prefix, strlen(serial_device_prefix) + 1);
#else
strncpy(x->serial_device_prefix, serial_device_prefix, strlen(serial_device_prefix) + 1);
strncpy(x->serial_device_prefix, serial_device_prefix, MAXPDSTRING);
#endif
x->serial_device = test.serial_device; /* we need this so 'help' doesn't crash */