All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smsutil: do not allow larger file names
@ 2011-01-28  2:48 Lucas De Marchi
  2011-01-29  2:38 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas De Marchi @ 2011-01-28  2:48 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]

If file name had anything in the name after addr-msgid, it would be
parsed as well. This is not what we want, since there could be temporary
files lying around.
---
 src/smsutil.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index 3a54fe6..ae9da0d 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -2713,6 +2713,7 @@ static void sr_assembly_load_backup(GHashTable *assembly_table,
 	unsigned int *id_table_key;
 	char msgid_str[SMS_MSGID_LEN * 2 + 1];
 	unsigned char msgid[SMS_MSGID_LEN];
+	char endc;
 
 	if (addr_dir->d_type != DT_REG)
 		return;
@@ -2724,8 +2725,8 @@ static void sr_assembly_load_backup(GHashTable *assembly_table,
 	 * Max of SMS address size is 12 bytes, hex encoded
 	 * Max of SMS SHA1 hash is 20 bytes, hex encoded
 	 */
-	if (sscanf(addr_dir->d_name, SMS_ADDR_FMT "-" SMS_MSGID_FMT,
-				straddr, msgid_str) < 2)
+	if (sscanf(addr_dir->d_name, SMS_ADDR_FMT "-" SMS_MSGID_FMT "%c",
+				straddr, msgid_str, &endc) != 2)
 		return;
 
 	if (sms_assembly_extract_address(straddr, &addr) == FALSE)
-- 
1.7.3.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] smsutil: do not allow larger file names
  2011-01-28  2:48 [PATCH] smsutil: do not allow larger file names Lucas De Marchi
@ 2011-01-29  2:38 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-01-29  2:38 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

Hi Lucas,

On 01/27/2011 08:48 PM, Lucas De Marchi wrote:
> If file name had anything in the name after addr-msgid, it would be
> parsed as well. This is not what we want, since there could be temporary
> files lying around.
> ---
>  src/smsutil.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-29  2:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-28  2:48 [PATCH] smsutil: do not allow larger file names Lucas De Marchi
2011-01-29  2:38 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.