From f5b1c954900d4ff2a8849a41a079d3f1221157ae Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Fri, 28 Jan 2011 00:48:59 -0200 Subject: [PATCH] smsutil: do not allow larger file names 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 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/smsutil.c b/src/smsutil.c index 1c3b7980..17623913 100644 --- a/src/smsutil.c +++ b/src/smsutil.c @@ -2726,6 +2726,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; @@ -2737,8 +2738,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)