Skip to content

Feature/pratica03#3

Merged
danielDL1001 merged 5 commits into
developfrom
feature/pratica03
Apr 24, 2026
Merged

Feature/pratica03#3
danielDL1001 merged 5 commits into
developfrom
feature/pratica03

Conversation

@danielDL1001
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0125b74da3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread aulas/agenda.c

Agenda criar_agenda(int tamanho) {
Agenda agenda;
agenda.tamanho = tamanho;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Cap agenda size to fixed contact array limit

Agenda stores contacts in a fixed contatos[LIMITE] buffer, but criar_agenda accepts any tamanho and adicionar_contato enforces only quantidade == tamanho. If a caller creates an agenda with tamanho > LIMITE (100), inserts beyond index 99 will write out of bounds and corrupt memory. Clamp tamanho to LIMITE (or enforce quantidade < LIMITE on insert) before using it as capacity.

Useful? React with 👍 / 👎.


void conta_depositar(Conta *conta, double valor)
{
conta->saldo += valor;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject negative values in deposits

conta_depositar applies saldo += valor without validating the sign, so passing a negative amount silently withdraws funds and bypasses the overdraft logic in conta_sacar. In any flow where valor comes from user input or external data, this produces incorrect balances. Guard deposits with valor > 0 before mutating the account.

Useful? React with 👍 / 👎.

Comment on lines +19 to +21
if (conta->saldo >= valor)
{
conta->saldo -= valor;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disallow negative withdrawals

The withdrawal check if (conta->saldo >= valor) treats negative valor as valid (the condition is usually true), and then saldo -= valor increases balance instead of decreasing it. This allows callers to credit money via the withdrawal path and breaks accounting correctness when inputs are not prevalidated upstream. Ensure withdrawals require valor > 0 before evaluating available balance.

Useful? React with 👍 / 👎.

@danielDL1001 danielDL1001 merged commit c8b72ee into develop Apr 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant