Skip to content

Commit

Permalink
Fixing -Werror=format-overflow errors (found by gcc-8.3.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
abarkov committed Apr 22, 2019
1 parent 279b50b commit 6c5e4c9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sql/sp_head.cc
Expand Up @@ -2885,7 +2885,7 @@ sp_head::show_routine_code(THD *thd)
const char *format= "Instruction at position %u has m_ip=%u";
char tmp[sizeof(format) + 2*SP_INSTR_UINT_MAXLEN + 1];

sprintf(tmp, format, ip, i->m_ip);
my_snprintf(tmp, sizeof(tmp), format, ip, i->m_ip);
/*
Since this is for debugging purposes only, we don't bother to
introduce a special error code for it.
Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_test3.c
Expand Up @@ -362,7 +362,7 @@ int test_write(MARIA_HA *file,int id,int lock_type)
maria_extra(file,HA_EXTRA_WRITE_CACHE,0);
}

sprintf((char*) record.id,"%7ld", (long) getpid());
my_snprintf((char*) record.id, sizeof(record.id), "%7ld", (long) getpid());
strnmov((char*) record.text,"Testing...", sizeof(record.text));

tries=(uint) rnd(100)+10;
Expand Down
4 changes: 2 additions & 2 deletions storage/maria/maria_chk.c
Expand Up @@ -1699,8 +1699,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
null_bit[0]=null_pos[0]=0;
if (keyseg->null_bit)
{
sprintf(null_bit,"%d",keyseg->null_bit);
sprintf(null_pos,"%ld",(long) keyseg->null_pos+1);
my_snprintf(null_bit, sizeof(null_bit), "%d", keyseg->null_bit);
my_snprintf(null_pos, sizeof(null_pos), "%ld", (long) keyseg->null_pos+1);
}
printf("%-7ld%-5d%-9s%-10s%-30s\n",
(long) keyseg->start+1,keyseg->length,
Expand Down
2 changes: 1 addition & 1 deletion storage/myisam/mi_test3.c
Expand Up @@ -364,7 +364,7 @@ int test_write(MI_INFO *file,int id,int lock_type)
mi_extra(file,HA_EXTRA_WRITE_CACHE,0);
}

sprintf((char*) record.id,"%7ld",(long) getpid());
my_snprintf((char*) record.id, sizeof(record.id), "%7ld", (long) getpid());
strnmov((char*) record.text,"Testing...", sizeof(record.text));

tries=(uint) rnd(100)+10;
Expand Down
4 changes: 2 additions & 2 deletions storage/myisam/myisamchk.c
Expand Up @@ -1404,8 +1404,8 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name)
null_bit[0]=null_pos[0]=0;
if (keyseg->null_bit)
{
sprintf(null_bit,"%d",keyseg->null_bit);
sprintf(null_pos,"%ld",(long) keyseg->null_pos+1);
my_snprintf(null_bit, sizeof(null_bit), "%d", keyseg->null_bit);
my_snprintf(null_pos, sizeof(null_pos), "%ld", (long) keyseg->null_pos+1);
}
printf("%-7ld%-5d%-9s%-10s%-30s\n",
(long) keyseg->start+1,keyseg->length,
Expand Down

0 comments on commit 6c5e4c9

Please sign in to comment.