void-packages/srcpkgs/expect/patches/0005-fix-buf-overflow-when-logging.patch
Đoàn Trần Công Danh a03d116397 srcpkgs/e*: convert patches to -Np1
```sh

git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

39 lines
1.4 KiB
Diff

diff -up exp_log.c.orig exp_log.c
--- a/exp_log.c 2013-12-12 12:43:38.527854189 +0100
+++ b/exp_log.c 2013-12-12 12:49:26.866576387 +0100
@@ -176,7 +176,7 @@ expStdoutLog TCL_VARARGS_DEF(int,arg1)
if ((!tsdPtr->logUser) && (!force_stdout) && (!tsdPtr->logAll)) return;
- (void) vsprintf(bigbuf,fmt,args);
+ (void) vsnprintf(bigbuf,sizeof(bigbuf),fmt,args);
expDiagWriteBytes(bigbuf,-1);
if (tsdPtr->logAll || (LOGUSER && tsdPtr->logChannel)) Tcl_WriteChars(tsdPtr->logChannel,bigbuf,-1);
if (LOGUSER) fprintf(stdout,"%s",bigbuf);
@@ -222,7 +222,7 @@ expErrorLog TCL_VARARGS_DEF(char *,arg1)
va_list args;
fmt = TCL_VARARGS_START(char *,arg1,args);
- (void) vsprintf(bigbuf,fmt,args);
+ (void) vsnprintf(bigbuf,sizeof(bigbuf),fmt,args);
expDiagWriteChars(bigbuf,-1);
fprintf(stderr,"%s",bigbuf);
@@ -264,7 +264,7 @@ expDiagLog TCL_VARARGS_DEF(char *,arg1)
fmt = TCL_VARARGS_START(char *,arg1,args);
- (void) vsprintf(bigbuf,fmt,args);
+ (void) vsnprintf(bigbuf,sizeof(bigbuf),fmt,args);
expDiagWriteBytes(bigbuf,-1);
if (tsdPtr->diagToStderr) {
@@ -307,7 +307,7 @@ expPrintf TCL_VARARGS_DEF(char *,arg1)
int len, rc;
fmt = TCL_VARARGS_START(char *,arg1,args);
- len = vsprintf(bigbuf,arg1,args);
+ len = vsnprintf(bigbuf,sizeof(bigbuf),arg1,args);
retry:
rc = write(2,bigbuf,len);
if ((rc == -1) && (errno == EAGAIN)) goto retry;