Skip to content

Commit

Permalink
Update memlock docs
Browse files Browse the repository at this point in the history
  • Loading branch information
paolostivanin committed Feb 16, 2024
1 parent 1099db3 commit ebb2b11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Highly secure and easy to use GTK+ software for two-factor authentication that s
| libsecret | 0.20 |
| qrencode | 4.0.2 |

:warning: Please note that the memlock value should be `>= 4 MB`. Any value less than this may cause issues when dealing with tens of tokens (especially when importing from third parties backups).
:warning: Please note that the memlock value should be `>= 64 MB`. Any value less than this may cause issues when dealing with tens of tokens (especially when importing from third parties backups).
See this [wiki section](https://github.com/paolostivanin/OTPClient/wiki/Secure-Memory-Limitations) for info on how to check the current value and set, if needed, a higher one.

## Features
Expand Down
6 changes: 3 additions & 3 deletions src/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ get_max_file_size_from_memlock (void)
struct rlimit r;
if (getrlimit (RLIMIT_MEMLOCK, &r) == -1) {
// couldn't get memlock limit, so falling back to a default, low value
g_print ("[WARNING] your OS's memlock limit may be too low for you (64000 bytes). Please have a look at %s\n", link);
g_print ("[WARNING] your operating system's memlock limit may be too low for you. Please have a look at %s\n", link);
return LOW_MEMLOCK_VALUE;
} else {
if (r.rlim_cur == -1 || r.rlim_cur > MEMLOCK_VALUE) {
// memlock is either unlimited or bigger than needed, so defaulting to 'MEMLOCK_VALUE'
return MEMLOCK_VALUE;
} else {
// memlock is less than 'MEMLOCK_VALUE'
g_print ("[WARNING] your OS's memlock limit may be too low for you (current value: %d bytes).\n"
g_print ("[WARNING] your operating system's memlock limit may be too low for you (current value: %d bytes).\n"
"This may cause issues when importing third parties databases or dealing with tens of tokens.\n"
"For information on how to increase the memlock value, please have a look at %s\n", (gint32)r.rlim_cur, link);
return (gint32)r.rlim_cur;
Expand Down Expand Up @@ -447,4 +447,4 @@ get_kf_ptr (void)
g_free (cfg_file_path);
g_key_file_free (kf);
return NULL;
}
}

0 comments on commit ebb2b11

Please sign in to comment.