@@ -504,6 +504,7 @@ void BuddyThreadClass::errorCallback( GPConnection *con, GPErrorArg *arg )
504504static void getNickForMessage ( GPConnection *con, GPGetInfoResponseArg *arg, void *param )
505505{
506506 BuddyResponse *resp = (BuddyResponse *)param;
507+ static_assert (ARRAY_SIZE (resp->arg .message .nick ) >= ARRAY_SIZE (arg->nick ), " Incorrect array size" );
507508 strcpy (resp->arg .message .nick , arg->nick );
508509}
509510
@@ -618,6 +619,9 @@ static void getInfoResponseForRequest( GPConnection *con, GPGetInfoResponseArg *
618619{
619620 BuddyResponse *resp = (BuddyResponse *)param;
620621 resp->profile = arg->profile ;
622+ static_assert (ARRAY_SIZE (resp->arg .request .nick ) >= ARRAY_SIZE (arg->nick ), " Incorrect array size" );
623+ static_assert (ARRAY_SIZE (resp->arg .request .email ) >= ARRAY_SIZE (arg->email ), " Incorrect array size" );
624+ static_assert (ARRAY_SIZE (resp->arg .request .countrycode ) >= ARRAY_SIZE (arg->countrycode ), " Incorrect array size" );
621625 strcpy (resp->arg .request .nick , arg->nick );
622626 strcpy (resp->arg .request .email , arg->email );
623627 strcpy (resp->arg .request .countrycode , arg->countrycode );
@@ -644,6 +648,9 @@ static void getInfoResponseForStatus(GPConnection * connection, GPGetInfoRespons
644648{
645649 BuddyResponse *resp = (BuddyResponse *)param;
646650 resp->profile = arg->profile ;
651+ static_assert (ARRAY_SIZE (resp->arg .status .nick ) >= ARRAY_SIZE (arg->nick ), " Incorrect array size" );
652+ static_assert (ARRAY_SIZE (resp->arg .status .email ) >= ARRAY_SIZE (arg->email ), " Incorrect array size" );
653+ static_assert (ARRAY_SIZE (resp->arg .status .countrycode ) >= ARRAY_SIZE (arg->countrycode ), " Incorrect array size" );
647654 strcpy (resp->arg .status .nick , arg->nick );
648655 strcpy (resp->arg .status .email , arg->email );
649656 strcpy (resp->arg .status .countrycode , arg->countrycode );
@@ -660,6 +667,8 @@ void BuddyThreadClass::statusCallback( GPConnection *con, GPRecvBuddyStatusArg *
660667 // get user's status
661668 GPBuddyStatus status;
662669 gpGetBuddyStatus ( con, arg->index , &status );
670+ static_assert (ARRAY_SIZE (response.arg .status .location ) >= ARRAY_SIZE (status.locationString ), " Incorrect array size" );
671+ static_assert (ARRAY_SIZE (response.arg .status .statusString ) >= ARRAY_SIZE (status.statusString ), " Incorrect array size" );
663672 strcpy (response.arg .status .location , status.locationString );
664673 strcpy (response.arg .status .statusString , status.statusString );
665674 response.arg .status .status = status.status ;
0 commit comments