File tree 2 files changed +22
-2
lines changed
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.81 2001/07/15 11:07:37 ishii Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.82 2001/09/11 05:18:59 ishii Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -75,10 +75,14 @@ bpcharin(PG_FUNCTION_ARGS)
75
75
int i ;
76
76
#ifdef MULTIBYTE
77
77
int charlen ; /* number of charcters in the input string */
78
+ char * ermsg ;
78
79
#endif
79
80
80
81
len = strlen (s );
81
82
#ifdef MULTIBYTE
83
+ if ((ermsg = pg_verifymbstr (s , len )))
84
+ elog (ERROR ,"%s" ,ermsg );
85
+
82
86
charlen = pg_mbstrlen (s );
83
87
#endif
84
88
@@ -405,8 +409,15 @@ varcharin(PG_FUNCTION_ARGS)
405
409
int32 atttypmod = PG_GETARG_INT32 (2 );
406
410
VarChar * result ;
407
411
size_t len , maxlen ;
412
+ #ifdef MULTIBYTE
413
+ char * ermsg ;
414
+ #endif
408
415
409
416
len = strlen (s );
417
+ #ifdef MULTIBYTE
418
+ if ((ermsg = pg_verifymbstr (s , len )))
419
+ elog (ERROR ,"%s" ,ermsg );
420
+ #endif
410
421
maxlen = atttypmod - VARHDRSZ ;
411
422
412
423
if (atttypmod >= (int32 ) VARHDRSZ && len > maxlen )
Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.71 2001/08/13 18:45:35 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.72 2001/09/11 05: 18:59 ishii Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -154,8 +154,17 @@ textin(PG_FUNCTION_ARGS)
154
154
char * inputText = PG_GETARG_CSTRING (0 );
155
155
text * result ;
156
156
int len ;
157
+ #ifdef MULTIBYTE
158
+ char * ermsg ;
159
+ #endif
157
160
158
161
len = strlen (inputText ) + VARHDRSZ ;
162
+
163
+ #ifdef MULTIBYTE
164
+ if ((ermsg = pg_verifymbstr (inputText , len - VARHDRSZ )))
165
+ elog (ERROR ,"%s" ,ermsg );
166
+ #endif
167
+
159
168
result = (text * ) palloc (len );
160
169
VARATT_SIZEP (result ) = len ;
161
170
You can’t perform that action at this time.
0 commit comments