Re: overruns in tprintf

Поиск
Список
Период
Сортировка
Искать

Re: overruns in tprintf

От:
Дата:
Applied.


[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Attached a small patch to eliminate overruns in tprintf*().
> Overruns crashes backend,
> run postmaster with "-d 3" and send it a large input (> 4kB)
> to verify.
> 
> 	regards,
> -- 
> -----------------
> G_ran Thyni
> http://kirra.net/

> diff -cr cvs/pgsql/src/backend/utils/misc/trace.c pgsql-patch/src/backend/utils/misc/trace.c
> *** cvs/pgsql/src/backend/utils/misc/trace.c	Sat Oct 17 07:06:09 1998
> --- pgsql-patch/src/backend/utils/misc/trace.c	Sat Oct 24 15:48:44 1998
> ***************
> *** 108,114 ****
>   #ifdef ELOG_TIMESTAMPS
>   	strcpy(line, tprintf_timestamp());
>   #endif
> ! 	vsprintf(line + TIMESTAMP_SIZE, fmt, ap);
>   	va_end(ap);
>   
>   #ifdef USE_SYSLOG
> --- 108,115 ----
>   #ifdef ELOG_TIMESTAMPS
>   	strcpy(line, tprintf_timestamp());
>   #endif
> ! 	vsnprintf(line + TIMESTAMP_SIZE, ELOG_MAXLEN,
> ! 		  fmt, ap);
>   	va_end(ap);
>   
>   #ifdef USE_SYSLOG
> ***************
> *** 138,144 ****
>   #ifdef ELOG_TIMESTAMPS
>   	strcpy(line, tprintf_timestamp());
>   #endif
> ! 	vsprintf(line+TIMESTAMP_SIZE, fmt, ap);
>   	va_end(ap);
>   
>   #ifdef USE_SYSLOG
> --- 139,146 ----
>   #ifdef ELOG_TIMESTAMPS
>   	strcpy(line, tprintf_timestamp());
>   #endif
> ! 	vsnprintf(line+TIMESTAMP_SIZE, ELOG_MAXLEN,
> ! 		 fmt, ap);
>   	va_end(ap);
>   
>   #ifdef USE_SYSLOG
> ***************
> *** 166,172 ****
>   #ifdef ELOG_TIMESTAMPS
>   	strcpy(line, tprintf_timestamp());
>   #endif
> ! 	vsprintf(line + TIMESTAMP_SIZE, fmt, ap);
>   	va_end(ap);
>   
>   #ifdef USE_SYSLOG
> --- 168,175 ----
>   #ifdef ELOG_TIMESTAMPS
>   	strcpy(line, tprintf_timestamp());
>   #endif
> ! 	vsnprintf(line + TIMESTAMP_SIZE, ELOG_MAXLEN,
> ! 		  fmt, ap);
>   	va_end(ap);
>   
>   #ifdef USE_SYSLOG
> ***************
> *** 344,350 ****
>   	    return;
>   	}
>   
> ! 	sprintf(buffer, "%s/%s", DataDir, "pg_options");
>   	if ((fd = open(buffer, O_RDONLY)) < 0)
>   		return;
>   
> --- 347,354 ----
>   	    return;
>   	}
>   
> ! 	snprintf(buffer, BUF_SIZE - 1,
> ! 		 "%s/%s", DataDir, "pg_options");
>   	if ((fd = open(buffer, O_RDONLY)) < 0)
>   		return;
>   
> 
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610) 853-3000 +  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026


--ELM909530318-3600-0_

--ELM909530318-3600-0_--

FAQ