Summary:ASTERISK-04595: [patch] Changes %i to %d
Reporter:Clod Patry (junky)Labels:
Date Opened:2005-07-15 00:02:30Date Closed:2008-01-15 15:41:32.000-0600
Versions:Frequency of
Environment:Attachments:( 0) i4d_rev1.txt
( 1) i4d_rev2.txt
Description:Like discussed via IRC with kpfleming,
All %i should be %d to avoid any problem, like ASTERISK-3794.
Comments:By: Russell Bryant (russell) 2005-07-15 00:08:19

In part of your patch for app_rpt.c, there was a comment above the line of code you changed specifying that it needed to be able to take in hex input as well as decimal.  So, in this case, it is appropriate to use %i.

By: Clod Patry (junky) 2005-07-15 00:17:30

rev2 fixes your requirement drumkilla.

By: Kevin P. Fleming (kpfleming) 2005-07-15 12:01:46

Sorry, when you brought this up on IRC, I thought you meant there were %i being using in sscanf(); there is no problem using %i in _output_ formats. I won't apply this patch as it stands, since it would be needless churn of the code...

However, there is one change in app_rpt.c in your patch that is legitimate, which I will apply.

By: Kevin P. Fleming (kpfleming) 2005-07-15 12:02:41

Fixed in CVS HEAD, thanks!

By: Tilghman Lesher (tilghman) 2005-07-15 12:04:15

Actually, you shouldn't change the other occurrence of %i in app_rpt.c either.  myatoi() is called by the routines which read in numbers from the config file.  If you look at the sample config file, there's at least one value encoded as hex, which will break if you change this file.

Considering use of this application requires first that you have a special board that isn't manufactured except by hobbyists, and you need an amateur radio license to even use the board, it's probably best not to mess with the source at all (except by someone who actually has such a board / license to use it).

By: Kevin P. Fleming (kpfleming) 2005-07-15 12:07:04

Yep, agreed, I'll revert the change. Thanks for the info.

By: Kevin P. Fleming (kpfleming) 2005-07-15 12:08:26

Reverted and added an appropriate comment.

By: Digium Subversion (svnbot) 2008-01-15 15:41:32.000-0600

Repository: asterisk
Revision: 6138

U   trunk/apps/app_rpt.c

r6138 | kpfleming | 2008-01-15 15:41:31 -0600 (Tue, 15 Jan 2008) | 2 lines

don't use 0 for scanf unless non-base-10 input is needed (bug ASTERISK-4595)