Skip to content

Commit 52c7f73

Browse files
authored
Merge pull request #15 from jeramey/master
Fix improper string handling which caused crashes
2 parents 6113a47 + 60b2f42 commit 52c7f73

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/decode_metar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static void parseCloudData( char *token, Decoded_METAR *Mptr, int next)
714714

715715
if( strlen(token) > 6 )
716716
strncpy(Mptr->cloudGroup[next].other_cld_phenom,token+6,
717-
(strlen(token)-6));
717+
min((strlen(token)-6), 3));
718718

719719
strncpy(Mptr->cloudGroup[next].cloud_type,token,3);
720720

src/metar_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ int main()
692692

693693
"LSZB 010250Z AUTO 16003KT 0200 R14/0175N FG VV001 01/01 Q0999",
694694

695+
"SAME 100100Z 32004KT 9999 SCT030 SCT04022/17 Q1020",
696+
695697
NULL};
696698

697699
Decoded_METAR Metar;

0 commit comments

Comments
 (0)