Fix comparison when checking for time skew when using authentication. (#674)

Fixes #673.

Submitted by @FuzzyStatic, reviewed by @ralcini.
This commit is contained in:
Bruce A. Mah 2018-01-02 14:55:01 -08:00 committed by GitHub
parent eddfb8267e
commit 1e93fdcf88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,7 @@ void sha256(const char *string, char outputBuffer[65])
int check_authentication(const char *username, const char *password, const time_t ts, const char *filename){
time_t t = time(NULL);
time_t utc_seconds = mktime(localtime(&t));
if ( (utc_seconds - ts) < 10 && (utc_seconds - ts) > 0 ){
if ( (utc_seconds - ts) > 10 || (utc_seconds - ts) < -10 ) {
return 1;
}