@@ -757,7 +757,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
757
757
sdvalout= NULL ;
758
758
xmod= MODE_ANY;
759
759
istable= false ;
760
- * partname= 0 ;
760
+ memset ( partname, 0 , sizeof (partname)) ;
761
761
bzero ((char *) &xinfo, sizeof (XINFO));
762
762
valid_info= false ;
763
763
valid_query_id= 0 ;
@@ -3123,13 +3123,14 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
3123
3123
#if defined(WITH_PARTITION_STORAGE_ENGINE)
3124
3124
if (table->part_info ) {
3125
3125
if (GetStringOption (" Filename" ) || GetStringOption (" Tabname" )
3126
- || GetStringOption (" Connect" )) {
3127
- strcpy (partname, decode (g, strrchr (name, ' #' ) + 1 ));
3126
+ || GetStringOption (" Connect" )) {
3127
+ strncpy (partname, decode (g, strrchr (name, ' #' ) + 1 ), sizeof (partname) - 1 );
3128
3128
// strcpy(partname, table->part_info->curr_part_elem->partition_name);
3129
- part_id= &table->part_info ->full_part_field_set ;
3129
+ // part_id= &table->part_info->full_part_field_set;
3130
3130
} else // Inward table
3131
- strcpy (partname, strrchr (name, slash) + 1 );
3132
- part_id= &table->part_info ->full_part_field_set ; // Temporary
3131
+ strncpy (partname, strrchr (name, slash) + 1 , sizeof (partname) - 1 );
3132
+
3133
+ part_id= &table->part_info ->full_part_field_set ; // Temporary
3133
3134
} // endif part_info
3134
3135
#endif // WITH_PARTITION_STORAGE_ENGINE
3135
3136
} else
@@ -6144,7 +6145,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
6144
6145
6145
6146
strcpy (dbpath, name);
6146
6147
p= strrchr (dbpath, slash);
6147
- strcpy (partname, ++p);
6148
+ strncpy (partname, ++p, sizeof (partname) - 1 );
6148
6149
strcat (strcat (strcpy (buf, p), " ." ), lwt);
6149
6150
*p= 0 ;
6150
6151
} else {
@@ -6195,7 +6196,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
6195
6196
6196
6197
#if defined(WITH_PARTITION_STORAGE_ENGINE)
6197
6198
if (part_info && !inward)
6198
- strcpy (partname, decode (g, strrchr (name, ' #' ) + 1 ));
6199
+ strncpy (partname, decode (g, strrchr (name, ' #' ) + 1 ), sizeof (partname) - 1 );
6199
6200
// strcpy(partname, part_info->curr_part_elem->partition_name);
6200
6201
#endif // WITH_PARTITION_STORAGE_ENGINE
6201
6202
@@ -6236,8 +6237,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,
6236
6237
6237
6238
#if defined(WITH_PARTITION_STORAGE_ENGINE)
6238
6239
if (part_info)
6239
- strcpy (partname,
6240
- decode (g, strrchr (name, (inward ? slash : ' #' )) + 1 ));
6240
+ strncpy (partname,
6241
+ decode (g, strrchr (name, (inward ? slash : ' #' )) + 1 ),
6242
+ sizeof (partname) - 1 );
6241
6243
#endif // WITH_PARTITION_STORAGE_ENGINE
6242
6244
6243
6245
if ((rc= optimize (table->in_use , NULL ))) {
0 commit comments