Coverity SECURE_CODING - CID 10695
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Indicator Date and Time |
Fix Released
|
Low
|
Charles Kerr | ||
0.3 |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This bug is exported from the Coverity Integration Manager on Canonical's servers. For information on how this is done please see this website: https:/
CID: 10695
Checker: SECURE_CODING
Category: No category available
CWE definition: http://
File: /tmp/buildd/
Function: input_time_text()
Code snippet:
404
405 if (is_locale_12h ()) { // TODO: make this look-at/watch gsettings?
406 char ampm[51];
407
CID 10695 - SECURE_CODING
[VERY RISKY]. Using "sscanf" can cause a buffer overflow when done incorrectly. sscanf() assumes an arbitrarily large string, so callers must use correct precision specifiers or never use sscanf(). Use correct precision specifiers or do your own parsing.
408 scanned = sscanf (text, "%u:%u:%u %50s", &hour_in, &minute_in, &second_in, ampm);
409 passed = (scanned == 4);
410
411 if (passed) {
412 const char *pm_str = nl_langinfo (PM_STR);
413 if (g_ascii_strcasecmp (pm_str, ampm) == 0) {
Related branches
- Ted Gould (community): Approve
-
Diff: 27 lines (+3/-0)1 file modifiedsrc/datetime-prefs.c (+3/-0)
- Ken VanDine: Pending requested
-
Diff: 777 lines (+263/-171)13 files modifiedChangeLog (+28/-0)
Makefile.am (+1/-35)
Makefile.am.coverage (+48/-0)
Makefile.in (+47/-41)
configure (+100/-64)
configure.ac (+4/-2)
data/Makefile.in (+0/-1)
debian/changelog (+10/-0)
m4/gcov.m4 (+13/-10)
src/Makefile.in (+0/-1)
src/datetime-prefs.c (+1/-8)
src/datetime-service.c (+11/-8)
tests/Makefile.in (+0/-1)
Changed in indicator-datetime: | |
importance: | Medium → Low |
status: | New → In Progress |
assignee: | nobody → charles (charlesk) |
Changed in indicator-datetime: | |
milestone: | none → 0.3.91 |
status: | Fix Committed → Fix Released |
Source file with Coverity annotations.