Skip to content

Commit

Permalink
spotify: Protect against very long log lines
Browse files Browse the repository at this point in the history
  • Loading branch information
andoma committed Mar 23, 2011
1 parent bf4bb09 commit e371544
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/spotify/spotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -1883,8 +1883,11 @@ static void
spotify_log_message(sp_session *session, const char *msg)
{
int l = strlen(msg);
if(l > 512)
l = 512;
char *s = alloca(l + 1);
memcpy(s, msg, l + 1);
memcpy(s, msg, l);
s[l] = 0;

if(l > 0 && s[l - 1] == '\n')
s[l - 1] = 0;
Expand Down

0 comments on commit e371544

Please sign in to comment.