* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fcrondyn.c,v 1.3 2002-03-31 15:03:46 thib Exp $ */
+ /* $Id: fcrondyn.c,v 1.4 2002-07-19 19:32:53 thib Exp $ */
/* fcrondyn : interact dynamically with running fcron process :
* - list jobs, with their status, next time of execution, etc
#include "allow.h"
#include "read_string.h"
-char rcs_info[] = "$Id: fcrondyn.c,v 1.3 2002-03-31 15:03:46 thib Exp $";
+char rcs_info[] = "$Id: fcrondyn.c,v 1.4 2002-07-19 19:32:53 thib Exp $";
void info(void);
void usage(void);
addr.sun_family = AF_UNIX;
if ( (len = strlen(fifofile)) > sizeof(addr.sun_path) )
die("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path));
- strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path));
+ strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path) - 1);
+ addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
if ( connect(fd, (struct sockaddr *) &addr, sizeof(addr.sun_family) + len) < 0 )
die_e("Cannot connect() to fcron (check if fcron is running)");
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fileconf.c,v 1.58 2002-02-25 18:42:00 thib Exp $ */
+ /* $Id: fileconf.c,v 1.59 2002-07-19 19:36:42 thib Exp $ */
#include "fcrontab.h"
/* check to see if next word is a username */
/* we don't allow quotes, to be able to distinguish a user name from
- * a command line (where quotes are allowed */
+ * a command line (where quotes are allowed) */
while ( isalnum( (int) ptr[indx]) ) indx++;
- if (indx > USER_NAME_LEN) indx = USER_NAME_LEN;
+ if (indx >= USER_NAME_LEN) indx = USER_NAME_LEN - 1;
strncpy(username, ptr, indx);
username[indx] = '\0';
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: log.c,v 1.12 2002-02-25 18:38:38 thib Exp $ */
+ /* $Id: log.c,v 1.13 2002-07-19 19:32:39 thib Exp $ */
/* This code is inspired by Anacron's sources of
Itai Tzur <itzur@actcom.co.il> */
* returns when the buffer overflows. Hmmm... */
len = vsnprintf(msg, MAX_MSG + 1, fmt, args);
if (len >= MAX_MSG)
- strcpy(msg + (MAX_MSG + 1) - sizeof(truncated), truncated);
+ strcpy(msg + (MAX_MSG - 1) - sizeof(truncated), truncated);
return msg;
}
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: socket.c,v 1.2 2002-03-31 15:06:19 thib Exp $ */
+ /* $Id: socket.c,v 1.3 2002-07-19 19:40:57 thib Exp $ */
/* This file contains all fcron's code (server) to handle communication with fcrondyn */
error("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path));
goto err;
}
- strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path));
+ strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path) - 1);
+ addr.sun_path[sizeof(addr.sun_path) -1 ] = '\0';
unlink(fifofile);
if (bind(listen_fd, (struct sockaddr *) &addr, sizeof(addr.sun_family)+len) != 0) {
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: temp_file.c,v 1.1 2002-02-25 18:44:37 thib Exp $ */
+ /* $Id: temp_file.c,v 1.2 2002-07-19 19:40:10 thib Exp $ */
#include "global.h"
#include "temp_file.h"
int fd;
#ifdef HAVE_MKSTEMP
char name_local[PATH_LEN] = "";
- strcpy(name_local, tmp_path);
+ strncpy(name_local, tmp_path, sizeof(name_local) - 1);
+ name_local[sizeof(name_local)-1] = '\0';
strcat(name_local, "fcr-XXXXXX");
if ( (fd = mkstemp(name_local)) == -1 )
die_e("Can't find a unique temporary filename");