Bug #54238 bad assignment in handle_slave_sql for skip_slave_counter
Submitted: 4 Jun 2010 16:16 Modified: 10 Oct 2010 19:44
Reporter: Mark Callaghan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1.47 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: replication, skip_slave_counter

[4 Jun 2010 16:16] Mark Callaghan
Description:
This code looks bad:
1) strmake() should handle the null termination
2) assigment of '\0' should be done to *pos not to pos

  if (rli->slave_skip_counter)
  {
    char *pos;
    pos= strmake(saved_log_name, rli->group_relay_log_name, FN_REFLEN - 1);
    pos= '\0';
    pos= strmake(saved_master_log_name, rli->group_master_log_name, FN_REFLEN - 1);
    pos= '\0';
    saved_log_pos= rli->group_relay_log_pos;
    saved_master_log_pos= rli->group_master_log_pos;
    saved_skip= rli->slave_skip_counter;
  }

The change appears to be from:
3366.1.2     alfranio.correia@sun.com                    20100504

How to repeat:
read the code

Suggested fix:
Add a regression test that will catch this
[4 Jun 2010 16:27] Mark Callaghan
This isn't serious as there is no read of pos after "pos = '\0'" is run to set pos to NULL.

But future changes could make this a real problem.
[4 Jun 2010 16:36] Andrew Hutchings
I think the idea is to throw away the return for strmake.  In which case maybe pos= NULL would be better than '/0'?
[8 Jul 2010 12:47] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/113126

3470 Alfranio Correia	2010-07-08
      BUG#54238 bad assignment in handle_slave_sql for skip_slave_counter
      
      Code cleanup: removed unused variable and bad assignment.
[10 Oct 2010 19:43] Alfranio Junior
This issues was fixed in the patch for 
  BUG#45288: pb2 returns a lot of compilation warnings on linux
[10 Oct 2010 19:44] Alfranio Junior
Duplicate of BUG#45288.