Skip to content

Commit

Permalink
Fix possible improper NULL string termination
Browse files Browse the repository at this point in the history
Make sure that the language string is always terminated by a NULL
character.  strncpy will copy at most 4 characters, but no NULL
character is implicitly appended so language will only be NULL
terminated if the string has fewer than 4 characers.
  • Loading branch information
Kyle Hill committed Sep 1, 2012
1 parent 535c4ac commit 0568eda
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp
Expand Up @@ -325,7 +325,10 @@ void CDVDDemuxHTSP::SubscriptionStart (htsmsg_t *m)
}

if((lang = htsmsg_get_str(sub, "language")))
{
strncpy(st.g->language, lang, sizeof(st.g->language));
st.g->language[sizeof(st.g->language) - 1] = '\0';
}

st.g->iId = m_Streams.size();
st.g->iPhysicalId = index;
Expand Down

0 comments on commit 0568eda

Please sign in to comment.