Ecere Software
/
sdk
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bb6d607
)
extras/ShortDate: Fixed crash on invalid month
author
Jerome St-Louis
<jerome@ecere.com>
Tue, 21 Aug 2012 18:59:20 +0000
(14:59 -0400)
committer
Jerome St-Louis
<jerome@ecere.com>
Tue, 21 Aug 2012 18:59:20 +0000
(14:59 -0400)
extras/types/ShortDate.ec
patch
|
blob
|
history
diff --git
a/extras/types/ShortDate.ec
b/extras/types/ShortDate.ec
index
7b603df
..
eab983f
100644
(file)
--- a/
extras/types/ShortDate.ec
+++ b/
extras/types/ShortDate.ec
@@
-13,7
+13,12
@@
public struct ShortDate : Date
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
if(day || month || year)
- sprintf(stringOutput, "%s %d, %d", months[month], day, year);
+ {
+ if(month >= january && month <= december)
+ sprintf(stringOutput, "%s %d, %d", months[month], day, year);
+ else
+ strcpy(stringOutput, "Invalid date");
+ }
else
stringOutput[0] = 0;
return stringOutput;