Skip to content

Commit

Permalink
Merge pull request #302 from paolostivanin/dev3_1_9
Browse files Browse the repository at this point in the history
Release 3.1.9
  • Loading branch information
paolostivanin authored Jul 3, 2023
2 parents a8d0a17 + 895c4b2 commit 0da7178
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(OTPClient VERSION "3.1.8" LANGUAGES "C")
project(OTPClient VERSION "3.1.9" LANGUAGES "C")
include(GNUInstallDirs)

configure_file("src/common/version.h.in" "version.h")
Expand Down
9 changes: 9 additions & 0 deletions data/com.github.paolostivanin.OTPClient.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@
</content_rating>

<releases>
<release version="3.1.9" date="2023-07-03">
<description>
<p>OTPClient 3.1.9 brings a couple of fixes:</p>
<ul>
<li>fix db corruption (#301)</li>
<li>fix crash when user changes db multiple times</li>
</ul>
</description>
</release>
<release version="3.1.8" date="2023-06-14">
<description>
<p>OTPClient 3.1.8 brings a single fix</p>
Expand Down
2 changes: 1 addition & 1 deletion src/change-file-cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ change_file (AppData *app_data)
default:
break;
}
gtk_widget_destroy (diag_changefile);
gtk_widget_hide (diag_changefile);

return res;
}
2 changes: 1 addition & 1 deletion src/common/andotp.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export_andotp (const gchar *export_path,
g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, "couldn't dump json data");
goto end;
}
gsize json_data_size = g_utf8_strlen (json_data, -1);
gsize json_data_size = strlen (json_data);

// https://github.com/andOTP/andOTP/blob/bb01bbd242ace1a2e2620263d950d9852772f051/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Constants.java#L109-L110
guint32 le_iterations = (g_random_int () % (PBKDF2_MAX_BACKUP_ITERATIONS - PBKDF2_MIN_BACKUP_ITERATIONS + 1)) + PBKDF2_MIN_BACKUP_ITERATIONS;
Expand Down
10 changes: 5 additions & 5 deletions src/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ json_object_get_hash (json_t *obj)
}
}

guint32 hash = jenkins_one_at_a_time_hash (tmp_string, g_utf8_strlen (tmp_string, -1) + 1);
guint32 hash = jenkins_one_at_a_time_hash (tmp_string, strlen (tmp_string) + 1);

gcry_free (tmp_string);

Expand All @@ -111,8 +111,8 @@ json_object_get_hash (json_t *obj)
gchar *
secure_strdup (const gchar *src)
{
gchar *sec_buf = gcry_calloc_secure (g_utf8_strlen (src, -1) + 1, 1);
memcpy (sec_buf, src, g_utf8_strlen (src, -1) + 1);
gchar *sec_buf = gcry_calloc_secure (strlen (src) + 1, 1);
memcpy (sec_buf, src, strlen (src) + 1);

return sec_buf;
}
Expand All @@ -124,15 +124,15 @@ g_trim_whitespace (const gchar *str)
if (g_utf8_strlen (str, -1) == 0) {
return NULL;
}
gchar *sec_buf = gcry_calloc_secure (g_utf8_strlen (str, -1) + 1, 1);
gchar *sec_buf = gcry_calloc_secure (strlen (str) + 1, 1);
int pos = 0;
for (int i = 0; str[i]; i++) {
if (str[i] != ' ') {
sec_buf[pos++] = str[i];
}
}
sec_buf[pos] = '\0';
gchar *secubf_newpos = (gchar *)gcry_realloc (sec_buf, g_utf8_strlen(sec_buf, -1) + 1);
gchar *secubf_newpos = (gchar *)gcry_realloc (sec_buf, strlen (sec_buf) + 1);

return secubf_newpos;
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/freeotp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export_freeotpplus (const gchar *export_path,

json_array_foreach (json_db_data, index, db_obj) {
gchar *uri = get_otpauth_uri (NULL, db_obj);
fwrite (uri, g_utf8_strlen (uri, -1), 1, fp);
fwrite (uri, strlen (uri), 1, fp);
g_free (uri);
}

Expand Down
2 changes: 1 addition & 1 deletion src/db-misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ encrypt_db (const gchar *db_path,
return (gpointer)derived_key;
}

gsize input_data_len = g_utf8_strlen (in_memory_json, -1) + 1;
gsize input_data_len = strlen (in_memory_json) + 1;
guchar *enc_buffer = g_malloc0 (input_data_len);

gcry_cipher_hd_t hd = open_cipher_and_set_data (derived_key, header_data->iv, IV_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion src/parse-uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ parse_parameters (const gchar *modified_uri,
{
gchar **tokens = g_strsplit (modified_uri, "?", -1);
gchar *escaped_issuer_and_label = g_uri_unescape_string (tokens[0], NULL);
gchar *mod_uri_copy_utf8 = g_utf8_offset_to_pointer(modified_uri, g_utf8_strlen (tokens[0], -1) + 1);
gchar *mod_uri_copy_utf8 = g_utf8_offset_to_pointer (modified_uri, g_utf8_strlen (tokens[0], -1) + 1);
g_strfreev (tokens);

tokens = g_strsplit (escaped_issuer_and_label, ":", -1);
Expand Down

0 comments on commit 0da7178

Please sign in to comment.