gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Using smsd to send multiline sms


From: Pawel Kot
Subject: Re: [PATCH] Using smsd to send multiline sms
Date: Fri, 18 Jul 2008 11:44:52 +0200

Hi,

On Fri, Jul 18, 2008 at 11:37, Joan <address@hidden> wrote:
>> AFAIR fread() in contrary to fgets() won'd null terminate the read
>> text. So you may end up with some garbage that way. Do you mind fixing
>> this?
> Ok, after working on it for some time and testing in our production
> machine it seems that is working as expected.
> Hope it's fine now.

Almost. With:
mlength=fread ((gchar *) sms.user_data[0].u.text, 1, GN_SMS_MAX_LENGTH
+ 1, smsFile);
You are able to read GN_SMS_MAX_LENGTH + 1 bytes. So mlength will get
GN_SMS_MAX_LENGTH + 1 value. In the sequent line:
sms.user_data[0].u.text[mlength]='\0';
will cause overflow.

I think that should read:
mlength=fread ((gchar *) sms.user_data[0].u.text, 1,
GN_SMS_MAX_LENGTH, smsFile);

Would you test with such change? If it works, I'll commit it in such form.

take care,
pkot
-- 
Pawel Kot




reply via email to

[Prev in Thread] Current Thread [Next in Thread]