1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 17:23:15 +02:00

api: do not free dynamic string on error in function string_dyn_concat

This commit is contained in:
Sébastien Helleu
2026-07-05 11:59:18 +02:00
parent 9aa3ae7293
commit 2adac0dad3
7 changed files with 16 additions and 4 deletions
+1
View File
@@ -11,6 +11,7 @@
- core: fix possible buffer overflow in command /color alias ([#2330](https://github.com/weechat/weechat/issues/2330))
- core: fix possible buffer overflow in list of commands displayed by /help ([#2330](https://github.com/weechat/weechat/issues/2330))
- core: fix buffer overflow in connection to SOCKS5 proxy ([#2325](https://github.com/weechat/weechat/issues/2325))
- api: do not free dynamic string on error in function string_dyn_concat
- api: fix infinite loop in function string_replace when the search string is empty
- irc: limit size of data received from the server to prevent memory exhaustion
- irc: fix out-of-bounds read on incoming DCC command with a quoted filename ending the message ([#2322](https://github.com/weechat/weechat/issues/2322))
+2
View File
@@ -3470,6 +3470,8 @@ Concatenate a string to a dynamic string.
The pointer _*string_ can change if the string is reallocated (if there is
not enough space to concatenate the string).
In case of error, the dynamic string is left unchanged.
Prototype:
[source,c]
+2
View File
@@ -3528,6 +3528,8 @@ Concaténer une chaîne dans une chaîne dynamique.
Le pointeur _*string_ peut changer si la chaîne est réallouée (s'il n'y a pas
assez de place pour concaténer la chaîne).
En cas d'erreur, la chaîne dynamique reste inchangée.
Prototype :
[source,c]
+3
View File
@@ -3635,6 +3635,9 @@ Concatenate a string to a dynamic string.
The pointer _*string_ can change if the string is reallocated (if there is
not enough space to concatenate the string).
// TRANSLATION MISSING
In case of error, the dynamic string is left unchanged.
Prototipo:
[source,c]
+3
View File
@@ -3585,6 +3585,9 @@ _WeeChat バージョン 1.8 以上で利用可, updated in 3.0_
文字列が再確保された場合 (文字列を連結するのに十分なサイズが確保されていなかった場合)
にはポインタ _*string_ が変わる可能性があります。
// TRANSLATION MISSING
In case of error, the dynamic string is left unchanged.
プロトタイプ:
[source,c]
+3
View File
@@ -3355,6 +3355,9 @@ _WeeChat ≥ 1.8, ажурирано у верзији 3.0._
Показивач на стринг _*string_ може да се промени ако се стринг реалоцира (у случају да нема довољно простора за надовезивање стринга).
// TRANSLATION MISSING
In case of error, the dynamic string is left unchanged.
Прототип:
[source,c]
+2 -4
View File
@@ -4759,6 +4759,8 @@ string_dyn_copy (char **string, const char *new_string)
* if the string had to be extended, or the same pointer if there was enough
* size to concatenate the new string.
*
* In case of error, the dynamic string is left unchanged.
*
* Returns:
* 1: OK
* 0: error
@@ -4794,11 +4796,7 @@ string_dyn_concat (char **string, const char *add, int bytes)
new_size_alloc = new_size;
string_realloc = realloc (ptr_string_dyn->string, new_size_alloc);
if (!string_realloc)
{
free (ptr_string_dyn->string);
free (ptr_string_dyn);
return 0;
}
ptr_string_dyn->string = string_realloc;
ptr_string_dyn->size_alloc = new_size_alloc;
}