History

address snprintf warnings

Ge Wang committed 3 years ago

Commit 2b091f41 parent af9e3622 files · +12 −5Browse files

Showing the changes to src/core/util_serial.cpp (1 of 2 files). Show all

Unified · Split

src/core/util_serial.cpp+7−2
@@ -126,9 +126,14 @@ using namespace std; · 125 unmodified lines
126126 vector<string> SerialIOManager::availableSerialDevices()
127127 {
128128 vector<string> devices;
129− const int buf_size = PATH_MAX;
129+ const int buf_size = 4096;
130+ // was PATH_MAX;
131+ // which apparently isn't
132+ // https://stackoverflow.com/questions/9449241/where-is-path-max-defined-in-linux
133+ // https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
134+ // https://news.ycombinator.com/item?id=14194681
130135 const char * serial_dir = "/dev/serial/by-id";
131− char link_buf[buf_size];
136+ char link_buf[buf_size+256]; // 1.5.0.1 (ge) added 256 for extra snprintf padding
132137 char path_buf[buf_size];
133138
134139 DIR * dir = opendir(serial_dir);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t