acanas / swad-core

Main core for SWAD platform (Social Workspace At a Distance)
GNU Affero General Public License v3.0
71 stars 17 forks source link

Possible Errors #8

Open raistmaj opened 7 years ago

raistmaj commented 7 years ago

File: swad_mail.c:894 Problem: Variable StrAddresses is used without been initialized. This array is declared as

char StrAddresses[Mai_MAX_LENGTH_STR_ADDR + 1];

If it is not the first email a coma is appended but the first address will be appended to an array containing garbage.

The C standard ensures that at global scope or using static definition the value will be 0, but within a scope, the array must be initialized.

char StrAddresses[Mai_MAX_LENGTH_STR_ADDR + 1] = {0};

File: swad_mark.c:844 Problem: FILE* FileUsrMarks is getting closed twice.

File: swad_indicator.c:1398 Problem: Returning an uninitialized integer. The function Ind_GetNumIndicatorsCrsFromDB is returning the local variable NumIndicatorsFromDB that it may be Uninitialized if the DB_QuerySELECT fails.

File: Various. Problem: fprintf and family are getting called with the %u string but the variable is a signed integer, this is not a big issue, but it may produce problems if the input comes from an user.

acanas commented 7 years ago

Thank you very much for your help. I think all the bugs you reported are fixed in version 16.102.

Amab commented 5 years ago

Thank you very much for your help. I think all the bugs you reported are fixed in version 16.102.

Maybe this issue should be closed.