Merge pull request #1608 from mattsta/fix-sentinel-current-epoch-segfault

Fix segfault from accessing array out of bounds
This commit is contained in:
Salvatore Sanfilippo 2014-03-14 22:56:24 +01:00
commit c65b75e740

View File

@ -1346,7 +1346,7 @@ char *sentinelHandleConfiguration(char **argv, int argc) {
ri->auth_pass = sdsnew(argv[2]);
} else if (!strcasecmp(argv[0],"current-epoch") && argc == 2) {
/* current-epoch <epoch> */
unsigned long long current_epoch = strtoull(argv[2],NULL,10);
unsigned long long current_epoch = strtoull(argv[1],NULL,10);
if (current_epoch > sentinel.current_epoch)
sentinel.current_epoch = current_epoch;
} else if (!strcasecmp(argv[0],"config-epoch") && argc == 3) {