Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buffer overrun warnings. #3

Open
wants to merge 2 commits into
base: led-support
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ports. See the man page for information about using the program.

Note that ser2net supports RFC 2217 (remote control of serial port
parameters), but you must have a compliant client. The only one I
know if is kermit (http://www.columbia.edu/kermit).
know of is kermit (http://www.columbia.edu/kermit).

If you want the opposite of ser2net (you want to connect to a "local"
serial port device that is really remote) then Cyclades has provided
Expand Down
20 changes: 10 additions & 10 deletions dataxfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \Y -> year */
case 'Y':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%d", time->tm_year + 1900);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand All @@ -1054,7 +1054,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \y -> day of the year (days since Jan 1) */
case 'y':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%d", time->tm_yday);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand All @@ -1075,7 +1075,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \m -> month (as a number) */
case 'm':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%d", time->tm_mon);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand All @@ -1096,7 +1096,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \D -> day of the month */
case 'D':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%d", time->tm_mday);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand All @@ -1106,7 +1106,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \H -> hour (24-hour time) */
case 'H':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%2.2d", time->tm_hour);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand All @@ -1116,7 +1116,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \h -> hour (12-hour time) */
case 'h':
{
char d[10], *dp;
char d[12], *dp;
int v;

v = time->tm_hour;
Expand All @@ -1133,7 +1133,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \i -> minute */
case 'i':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%2.2d", time->tm_min);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand All @@ -1144,7 +1144,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
case 'S':
seconds:
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%2.2d", time->tm_sec);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand Down Expand Up @@ -1174,7 +1174,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \T -> time (HH:MM:SS) */
case 'T':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%2.2d:%2.2d:%2.2d",
time->tm_hour, time->tm_min, time->tm_sec);
for (dp = d; *dp; dp++)
Expand All @@ -1195,7 +1195,7 @@ process_str(port_info_t *port, struct tm *time, struct timeval *tv,
/* \U -> microseconds in the current second */
case 'U':
{
char d[10], *dp;
char d[12], *dp;
snprintf(d, sizeof(d), "%6.6ld", tv->tv_usec);
for (dp = d; *dp; dp++)
op(data, *dp);
Expand Down