Skip to content
Permalink
Browse files

Fix compilation with gcc 8 (-Wstringop-truncation)

```
src/rpc.c: In function ‘dcc_r_sometoken_int’:
src/rpc.c:221:5: error: ‘strncpy’ output may be truncated copying 4
bytes from a string of length 12 [-Werror=stringop-truncation]
     strncpy(token, buf, 4);
     ^~~~~~~~~~~~~~~~~~~~~~
```
  • Loading branch information...
rmatev committed Jul 14, 2019
1 parent a8615a5 commit b3a8203c08d948a4afb60f1e172667d07caff35d
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/rpc.c
@@ -218,7 +218,7 @@ int dcc_r_sometoken_int(int ifd, char *token, unsigned *val)
return ret;
}

strncpy(token, buf, 4);
memcpy(token, buf, 4);
token[4] = '\0';

buf[12] = '\0'; /* terminate */

0 comments on commit b3a8203

Please sign in to comment.
You can’t perform that action at this time.