From 3d64a152643ab2f0e98550b63c7e93dfa6a72ac7 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 11 Apr 2005 20:20:05 +0000 Subject: [PATCH] *** empty log message *** --- webcit/serv_func.c | 26 +++++++++++++------------- webcit/siteconfig.c | 5 +++-- webcit/sysmsgs.c | 4 ++-- webcit/tcp_sockets.c | 2 +- webcit/tools.c | 8 ++++---- webcit/useredit.c | 12 ++++++------ 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/webcit/serv_func.c b/webcit/serv_func.c index dca9352bf..160105f55 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -74,28 +74,28 @@ void get_serv_info(char *browser_host, char *user_agent) WC->ctdl_pid = serv_info.serv_pid; break; case 1: - strcpy(serv_info.serv_nodename, buf); + safestrncpy(serv_info.serv_nodename, buf, sizeof serv_info.serv_nodename); break; case 2: - strcpy(serv_info.serv_humannode, buf); + safestrncpy(serv_info.serv_humannode, buf, sizeof serv_info.serv_humannode); break; case 3: - strcpy(serv_info.serv_fqdn, buf); + safestrncpy(serv_info.serv_fqdn, buf, sizeof serv_info.serv_fqdn); break; case 4: - strcpy(serv_info.serv_software, buf); + safestrncpy(serv_info.serv_software, buf, sizeof serv_info.serv_software); break; case 5: serv_info.serv_rev_level = atoi(buf); break; case 6: - strcpy(serv_info.serv_bbs_city, buf); + safestrncpy(serv_info.serv_bbs_city, buf, sizeof serv_info.serv_bbs_city); break; case 7: - strcpy(serv_info.serv_sysadm, buf); + safestrncpy(serv_info.serv_sysadm, buf, sizeof serv_info.serv_sysadm); break; case 9: - strcpy(serv_info.serv_moreprompt, buf); + safestrncpy(serv_info.serv_moreprompt, buf, sizeof serv_info.serv_moreprompt); break; case 14: serv_info.serv_supports_ldap = atoi(buf); @@ -125,7 +125,7 @@ void fmout(FILE *fp, char *align) serv_getln(buf, sizeof buf); if (fp != NULL) { if (fgets(buf, SIZ, fp) == NULL) - strcpy(buf, "000"); + safestrncpy(buf, "000", sizeof buf); buf[strlen(buf) - 1] = 0; } if (!strcmp(buf, "000")) { @@ -176,7 +176,7 @@ void text_to_server(char *ptr, int convert_to_html) int ch, a, pos; pos = 0; - strcpy(buf, ""); + buf[0] = 0; while (ptr[pos] != 0) { ch = ptr[pos++]; @@ -185,7 +185,7 @@ void text_to_server(char *ptr, int convert_to_html) && (strlen(buf) > 1) ) buf[strlen(buf) - 1] = 0; serv_puts(buf); - strcpy(buf, ""); + buf[0] = 0; if (convert_to_html) { strcat(buf, "
"); } @@ -202,11 +202,11 @@ void text_to_server(char *ptr, int convert_to_html) if ((ch == 32) && (strlen(buf) > 200)) { buf[a] = 0; serv_puts(buf); - strcpy(buf, ""); + buf[0] = 0; } if (strlen(buf) > 250) { serv_puts(buf); - strcpy(buf, ""); + buf[0] = 0; } } } @@ -285,7 +285,7 @@ char *read_server_text(void) { if (text == NULL) { return(NULL); } - strcpy(text, ""); + text[0] = 0; bytes_allocated = SIZ; while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index 46f64c409..26462030a 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -680,7 +680,7 @@ void siteconfig(void) serv_printf("CONF set"); serv_getln(buf, sizeof buf); if (buf[0] != '4') { - strcpy(WC->ImportantMessage, &buf[4]); + safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage); display_siteconfig(); return; } @@ -733,6 +733,7 @@ void siteconfig(void) serv_printf("SPEX mailboxes|%d|%d", atoi(bstr("mboxpolicy")), atoi(bstr("mboxvalue"))); serv_getln(buf, sizeof buf); - strcpy(WC->ImportantMessage, "System configuration has been updated."); + safestrncpy(WC->ImportantMessage, "System configuration has been updated.", + sizeof WC->ImportantMessage); display_siteconfig(); } diff --git a/webcit/sysmsgs.c b/webcit/sysmsgs.c index 9f8800754..ddf38ad9f 100644 --- a/webcit/sysmsgs.c +++ b/webcit/sysmsgs.c @@ -38,7 +38,7 @@ void display_edit(char *description, char *check_cmd, serv_getln(buf, sizeof buf); if (buf[0] != '2') { - strcpy(WC->ImportantMessage, &buf[4]); + safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage); display_main_menu(); return; } @@ -91,7 +91,7 @@ void save_edit(char *description, char *enter_cmd, int regoto) serv_puts(enter_cmd); serv_getln(buf, sizeof buf); if (buf[0] != '4') { - strcpy(WC->ImportantMessage, &buf[4]); + safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage); display_main_menu(); return; } diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index 6880cd28b..1d3604d5d 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -169,7 +169,7 @@ void serv_getln(char *strbuf, int bufsize) char buf[2]; len = 0; - strcpy(strbuf, ""); + strbuf[0] = 0; do { serv_read(&buf[0], 1); ch = buf[0]; diff --git a/webcit/tools.c b/webcit/tools.c index f001ffb7e..3f445c9b0 100644 --- a/webcit/tools.c +++ b/webcit/tools.c @@ -82,7 +82,7 @@ void extract_token(char *dest, const char *source, int parmnum, char separator, int count = 0; int len = 0; - strcpy(dest, ""); + dest[0] = 0; /* Locate desired parameter */ s = source; @@ -200,7 +200,7 @@ void fmt_date(char *buf, time_t thetime) struct tm *tm; int hour; - strcpy(buf, ""); + buf[0] = 0; tm = localtime(&thetime); hour = tm->tm_hour; if (hour == 0) @@ -226,7 +226,7 @@ void fmt_time(char *buf, time_t thetime) struct tm *tm; int hour; - strcpy(buf, ""); + buf[0] = 0; tm = localtime(&thetime); hour = tm->tm_hour; if (hour == 0) @@ -249,7 +249,7 @@ void httpdate(char *buf, time_t thetime) { struct tm *tm; - strcpy(buf, ""); + buf[0] = 0; tm = localtime(&thetime); sprintf(buf, "%s, %02d %s %4d %02d:%02d:%02d", diff --git a/webcit/useredit.c b/webcit/useredit.c index b11f240c2..18be202e2 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -246,10 +246,10 @@ void display_edituser(char *supplied_username, int is_new) { int i; if (supplied_username != NULL) { - strcpy(username, supplied_username); + safestrncpy(username, supplied_username, sizeof username); } else { - strcpy(username, bstr("username") ); + safestrncpy(username, bstr("username"), sizeof username); } serv_printf("AGUP %s", username); @@ -379,7 +379,7 @@ void edituser(void) { is_new = atoi(bstr("is_new")); if (strcasecmp(bstr("action"), "OK")) { - strcpy(message, "Edit user cancelled."); + safestrncpy(message, "Edit user cancelled.", sizeof message); } else { @@ -402,7 +402,7 @@ void edituser(void) { "%s

\n", &buf[4]); } else { - strcpy(message, ""); + safestrncpy(message, "", sizeof message); } } @@ -430,7 +430,7 @@ void delete_user(char *username) { "%s

\n", &buf[4]); } else { - strcpy(message, ""); + safestrncpy(message, "", sizeof message); } select_user_to_edit(message, bstr("username")); } @@ -443,7 +443,7 @@ void create_user(void) { char error_message[SIZ]; char username[SIZ]; - strcpy(username, bstr("username")); + safestrncpy(username, bstr("username"), sizeof username); serv_printf("CREU %s", username); serv_getln(buf, sizeof buf); -- 2.39.2