Add buffer length setting

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

Add buffer length setting

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
I few places in PQrequestCancel() did not set the errorMessage buffer
length.  This patch fixes that.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.286
diff -c -c -r1.286 fe-connect.c
*** src/interfaces/libpq/fe-connect.c	21 Oct 2004 20:23:19 -0000	1.286
--- src/interfaces/libpq/fe-connect.c	29 Oct 2004 17:51:13 -0000
***************
*** 2252,2257 ****
--- 2252,2258 ----
  	{
  		strcpy(conn->errorMessage.data,
  			   "PQrequestCancel() -- socket() failed: ");
+ 		conn->errorMessage.len = strlen(conn->errorMessage.data);
  		goto cancel_errReturn;
  	}
  retry3:
***************
*** 2263,2268 ****
--- 2264,2270 ----
  			goto retry3;
  		strcpy(conn->errorMessage.data,
  			   "PQrequestCancel() -- connect() failed: ");
+ 		conn->errorMessage.len = strlen(conn->errorMessage.data);
  		goto cancel_errReturn;
  	}
  
***************
*** 2285,2290 ****
--- 2287,2293 ----
  			goto retry4;
  		strcpy(conn->errorMessage.data,
  			   "PQrequestCancel() -- send() failed: ");
+ 		conn->errorMessage.len = strlen(conn->errorMessage.data);
  		goto cancel_errReturn;
  	}
  

Re: Add buffer length setting

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Magnus pointed out that cancel_errReturn sets the lengths after the
goto.  Should I reverse out this patch?

---------------------------------------------------------------------------

Bruce Momjian wrote:
> I few places in PQrequestCancel() did not set the errorMessage buffer
> length.  This patch fixes that.
> 
> -- 
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

> Index: src/interfaces/libpq/fe-connect.c
> ===================================================================
> RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v
> retrieving revision 1.286
> diff -c -c -r1.286 fe-connect.c
> *** src/interfaces/libpq/fe-connect.c	21 Oct 2004 20:23:19 -0000	1.286
> --- src/interfaces/libpq/fe-connect.c	29 Oct 2004 17:51:13 -0000
> ***************
> *** 2252,2257 ****
> --- 2252,2258 ----
>   	{
>   		strcpy(conn->errorMessage.data,
>   			   "PQrequestCancel() -- socket() failed: ");
> + 		conn->errorMessage.len = strlen(conn->errorMessage.data);
>   		goto cancel_errReturn;
>   	}
>   retry3:
> ***************
> *** 2263,2268 ****
> --- 2264,2270 ----
>   			goto retry3;
>   		strcpy(conn->errorMessage.data,
>   			   "PQrequestCancel() -- connect() failed: ");
> + 		conn->errorMessage.len = strlen(conn->errorMessage.data);
>   		goto cancel_errReturn;
>   	}
>   
> ***************
> *** 2285,2290 ****
> --- 2287,2293 ----
>   			goto retry4;
>   		strcpy(conn->errorMessage.data,
>   			   "PQrequestCancel() -- send() failed: ");
> + 		conn->errorMessage.len = strlen(conn->errorMessage.data);
>   		goto cancel_errReturn;
>   	}
>   

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Add buffer length setting

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian  writes:
> Magnus pointed out that cancel_errReturn sets the lengths after the
> goto.  Should I reverse out this patch?

Yes.

			regards, tom lane
FAQ