Skip to content

Commit

Permalink
[utils] Fixed compiler warning
Browse files Browse the repository at this point in the history
Even if harmless, make the code consistent and avoid warnings - if using null-termiated functions, be sure you have the space for the the ending NULL.
Reported by Dan Pascu ( @danpascu )

(cherry picked from commit decbd1b)
  • Loading branch information
bogdan-iancu committed May 29, 2019
1 parent 82f12d0 commit f8e0cbb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions utils/db_berkeley/bdb_recover.c
Expand Up @@ -483,9 +483,7 @@ int extract_key(table_p tp, char* k, char* d)
p = k;

/*copy data so we can tokenize w.o trampling */
len = strlen(d);
strncpy(buf, d, len);
buf[len] = 0;
strcpy(buf, d);

s = strtok(buf, "|");
while(s!=NULL && n<MAX_NUM_COLS)
Expand All @@ -495,7 +493,7 @@ int extract_key(table_p tp, char* k, char* d)
{
if( tp->colp[n]->kflag )
{
strncpy(p, s, len);
memcpy(p, s, len);
p+=len;

*p = '|';
Expand Down

0 comments on commit f8e0cbb

Please sign in to comment.