Code Room
Code reviewMediumcr-g156
Subject Buffer overflowLevel Mid–Senior~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this C string-copy helper.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewc
#include <string.h>#include <stdlib.h> char *dup_upper(const char *src) {    size_t len = strlen(src);    char *out = malloc(len);          /* room for the chars */    for (size_t i = 0; i < len; i++) {        char c = src[i];        out[i] = (c >= 'a' && c <= 'z') ? c - 32 : c;    }    out[len] = '\0';                  /* terminate */    return out;}
Run or narrate your approach, then ask the coach.