Thu Feb 11 13:11:20 PST 2010
- Previous message: [Slony1-commit] slony1-engine/src/slon misc.c
- Next message: [Slony1-commit] slony1-engine/src/slon misc.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/slon In directory main.slony.info:/tmp/cvs-serv25172 Modified Files: misc.c Log Message: Apply to HEAD... Gwyn Connor pointed out a sprintf() abuse... When log entries are generated, we're passing outbuf both as buffer and as a source of data. Behaviour is undefined on some systems, notably including Gentoo Linux. Change: Make sure there are buffers for the date + process, fill them, and reference them. Index: misc.c =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/slon/misc.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C 2 -d -r1.31 -r1.32 *** misc.c 9 Dec 2009 20:54:38 -0000 1.31 --- misc.c 11 Feb 2010 21:11:17 -0000 1.32 *************** *** 80,84 **** char *level_c = NULL; ! char time_buf[128]; time_t stamp_time = time(NULL); --- 80,85 ---- char *level_c = NULL; ! char time_buf[128]; /* Buffer to hold timestamp */ ! char ps_buf[20]; /* Buffer to hold PID */ time_t stamp_time = time(NULL); *************** *** 174,184 **** slon_retry(); } ! sprintf(outbuf, "%s ", time_buf); } if (logpid == true) { ! sprintf(outbuf, "%s[%d] ", outbuf, slon_pid); } ! sprintf(outbuf, "%s%-6.6s ", outbuf, level_c); off = (int) strlen(outbuf); --- 175,190 ---- slon_retry(); } ! } else { ! time_buf[0] = (char) 0; } + if (logpid == true) { ! sprintf(ps_buf, "[%d] ", slon_pid); ! } else { ! ps_buf[0] = (char) 0; } ! ! sprintf(outbuf, "%s%s%-6.6s ", time_buf, ps_buf, level_c); off = (int) strlen(outbuf);
- Previous message: [Slony1-commit] slony1-engine/src/slon misc.c
- Next message: [Slony1-commit] slony1-engine/src/slon misc.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list